Shell we Nix?

Ever wanted a way to quickly & temporarily install an amusing command-line tool that you read about on the interwebz? I certainly needed something like that since forever. Every now and then I gotta compress a JPEG using imagemagick, format a markdown file using prettier, or demonstrate to my colleagues that [,,,].length is a valid JavaScript expression, while not having Node.js installed on my machine. Second best thing I had was Homebrew. I’d brew install the tool, take it for a spin, and hopefully remember to brew uninstall it afterwards - or else it’ll not only bloat my system, but also slow down brew upgrades even more for the forseable future until I factory-reset my machine next Spring cleaning. ...

March 9, 2025 · 2 min · Abdelrahman Abdelhafez

Generate large files in Unix ad hoc

A neat trick to generate large files ad hoc is to run one of the simplest Unix commands ever: yes. When executed, it regurgitates an infinite stream of ys (suffixed with newlines): $ yes y y y y ... Piping its output into a file for approximately 10 seconds on a Mac Mini (M1, 2020) yields an 18-GB file containing 9.6 billion lines! $ yes >> yes.log ^C $ ls -lh total 37664520 -rw-r--r-- 1 abdelrahman staff 18G Dec 28 17:16 yes.log $ wc -l yes.log 9637725825 yes.log

December 28, 2022 · 1 min · Abdelrahman Abdelhafez