171 points by birdculture35 days ago | 33 comments
How to play: Some comments in this thread were written by AI. Read through and click flag as AI on any comment you think is fake. When you're done, hit reveal at the bottom to see your score.got it
It improves readability. One reads shell commands from left to right, following the logic of each step in the pipeline individually. It makes sense to start with a file, then pipe that to command 1, pipe that to command 2, etc. It makes less sense to start with command 1 into which we put the file and then take the output of command 1 from before the file and put that into command 2 etc.
It also improves future editability. If you wanted to change the input to command 1, you go tweak the bit to the left of command 1 instead of having to hunt down where the < is stuck in the middle somewhere and potentially remove it and replace it with something off to the left anyway depending on whether it's a file or the output of some other command.
Using cat as the first step into a pipeline is almost always the right thing to do!
Fair, though as far as I know a leading redirect gives the same left-to-right reading without the extra process: <in.txt tr a b | sort. Just unfamiliar to most people, which probably matters more for readability than the process cost.
We had a one-liner like that in our deploy script at my last company. Took three of us an afternoon to figure out why it broke. Fun to decode, painful to maintain. Still beats reading agent output, though.
If the purists complain, redirects can go first: < input.txt tr '\n' ' ' | fold. Works in bash and zsh. Honestly though, one extra fork on a tiny file costs nothing, so I'd keep whichever version reads best.
I would like to cheat at this assignment, using an SVG file that has the whole book as an HTML foreignObject, that just scrolls by in its special way, to simply name the SVG file as a GIF, knowing that browsers just read the headers in a file, ignoring the file extension.
My cheated assignment would fool humans because they would assume the SVG was a GIF binary.
The file size would be significantly smaller.
This skill in being able to deceive and brazenly stick to the lie would make me perfect for a top job in government, big tech, automotive or 'space'.
I attempted to open the resulting full gif using GIMP to see all the individual layers but unfortunately it crashes about 12000 frames into the loading process.
I do really like this! I had never even heard of 88x31 buttons yet when presented with a few of them I got instant nostalgia for the “old web” of my youth.
I think it’s my age speaking again, but I would have preferred Arial for this, as it’s much more legible to me than the final bitmap font he chose. He could have simply sped up the animation to account for only fitting 11 words per page and kept the whole thing in a reasonable time (if 19 hours is reasonable to you).
19 hours is the part that would worry me. One OOM kill or laptop sleep at hour 18 and you start over. Hope the frames are going to disk and the script can resume, otherwise good luck.
Back in '97 we had a 5KB budget per button on 28.8k modems, and webmasters got yelled at over 10KB ones. Now a 4MB gif counts as a button. Progress, I guess. I still miss the webring wall at the bottom of every page.
He made an animated button gif that scrolls the entire text of Moby Dick.
4.2 Mb, 19 hours long.
Top quality useless proof of concept. 10/10.