I don't have Python installed

Just ran into a Python script out in the wild 1. Had to run it, but I have neither a Python interpreter on my machine nor the packages which the script depends on. Wasn’t a problem, though. To run this asciicast without javascript, use asciinema play https://abdelrahman.sh/2025/11/i-do-not-have-python-installed/nix-shell.cast with Asciinema To set up the hacs_waste_collection_schedule integration on Home Assistant, you must run a Python script that prompts you for your home address, which it then uses to compute the parameters with which you can set up the integration. ↩︎ ...

November 16, 2025 · 1 min · Abdelrahman Abdelhafez

Finessing Unix pipes

Next time you explore textual data in your terminal, do yourself a favor and try out up1. You will be overcome by an overwhelming urge to shed a tear or two out of sheer joyfullness. Here’s a recording where I pipe a JSON file into up and play around with it: To run this asciicast without javascript, use asciinema play https://abdelrahman.sh/2025/09/finessing-unix-pipes/up.cast with Asciinema https://github.com/akavel/up ↩︎

September 22, 2025 · 1 min · Abdelrahman Abdelhafez

Scripting with Kotlin

Kotlin code can be run ad hoc using the Kotlin compiler’s -script option1! kotlinc -script my-skript.kts To run this asciicast without javascript, use asciinema play https://abdelrahman.sh/2025/09/scripting-with-kotlin/kotlinc-script.cast with Asciinema https://kotlinlang.org/docs/command-line.html#run-scripts ↩︎

September 15, 2025 · 1 min · Abdelrahman Abdelhafez

How-to: PDFs

OCR nix shell nixpkgs#ocrmypdf --command ocrmypdf --language deu --force-ocr input.pdf output.pdf OCRs the German text in the scanned document and overlays the OCRed text onto it. Deskew nix shell nixpkgs#ocrmypdf --command ocrmypdf --deskew input.pdf output.pdf Deskews crooked pages. Fake duplex nix shell nixpkgs#pdfcpu --command pdfcpu merge -mode zip output.pdf front.pdf back.pdf Produces a 2-sided document by interleaving the given odd- and even-numbered pages (scanned by a non-duplex scanner). Extract images nix shell nixpkgs#poppler_utils --command pdfimages -j -png input.pdf sample Extracts the JPEGs from the given document as PNGs.

September 14, 2025 · 1 min · Abdelrahman Abdelhafez

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