Lots of videos about it and lots of ways that work or don't work anymore. Today i bring you my way and making it as simple as possible.
First off build a construction that looks like this
Sticky piston on top and normal piston down. And make wiring so it make both up and down work.
When you made this Construction you need to make flashing lights so the piston move the whole time and keep spamming the sand blocks. Here one of the flashing lights you can make and one of my favorites as it's a fast one.
1. First off power up the repeaters with redstone torch.
2. Remove the redstone torch so the repeaters stay powered now
3. Now comes the tricky part you have to remove a redwire and place a new one right after it. So it starts flashing like this
Connect it to your pistons and have fun afk getting sand blocks or flint.
Cobblestone Generator
My generator looks like this
On the side where the lava is you have to make it flow down unlike water it's the same level as the cobblestone. If you have the lava same level as water then you will be making obsidian.
Now connect the redwires to the normal piston don't use sticky piston for this one. And you can use same flashing lights like explained above to make it spam the cobblestone for you.