How I ask GPT-4 to make tiny Python scripts in practice

First get a working script. “Hey GPT-4, write me a ChatGPT script that does .” Manually check over the script and iterate until it’s giving me what I want. “Now wrap the script into a click command-line interface.” I almost always specify to use an --input flag and an --output flag. If the data it’s working with is human-readable, “Make it so that if --input is not specified, it reads data from stdin.” If the data it’s writing is human-readable, “Make it so that if --output is not specified, it emits data to stdout.” If the script is complicated enough that error logging is warranted: “Add logging and colorlog. Ensure all error messages are written to stderr so that it does not clash with output.” This advice is optimized for small Python scripts, usually under 200 lines in total, for automating semi-mundane tasks like ...

August 22, 2024

Valuable software is about letting people do new things

Today I released a dump of six months of flashcards I autogenerated from my tiny Finnish news archive to make the lives of my fellow language learners easier. The actual code which generates this archive is about 300 lines of Python . The basic value add for the user: What you want: Better fluency in Finnish. What you need: Practice. Lots of it. What this gives you: GOTO 2. This is emphatically not the kind of product, or use case, I would stumble upon as a brain-in-the-vat developer. It is a niche offering, one I only found because I actually got out into the world and tried to do something hard. In so doing, I recognized the possibility of building a tool that could help me in this non-programming endeavour. So I built it. And I’m proud of it. ...

June 21, 2024

Layers of abstraction for me, not for thee

Consider the problem of “how do I run more than 1 terminal at a time”. At this moment, I have at least 5 different ways I can effectively solve this issue: I can, from a different physical computer, SSH in to a new session. I can, from the same physical computer, switch to a different tty session with … C-S-F2 through 6 or something. (Rare, but sometimes it comes in really handy.) I can, in the same user session, open 2 separate windows of a terminal emulator. I can, in the same terminal emulator, open a new tab. I can, in the same emulated terminal, run tmux and open a new pane. There are yet more exotic options like Serial over LAN that I’m only theoretically aware of. ...

June 18, 2024

OpenBSD, the computer appliance maker's secret weapon

Between our ESP32 prokaryotic organisms and our 24/7 Internet-enabled megafauna servers, there exists a vast and loosely-defined ecosystem of things the B2B world likes to call computer appliances. Picture a bespoke Pi 4 packaged up neatly with some Python scripts, a little fancy plastic embossing, and maybe a well-guarded id_ed25519.pub in case you end up in hot water during the (long - very long, stable cash flow for generations long) maintenance contract, and you’re in the ballpark. ...

June 5, 2024

Quickstarts and Slowstarts

A while back I stirred up some controversy on Hacker News by talking about why I liked it when tutorials take you from clean VM to working, installed software. I’ve since taken to calling this the “tutorial-in-a-box” method. When I write them myself, I usually put them under the header Slowstart, a riff on the proverbial Quickstart. Two examples: A gentle introduction to reposurgeon. The Slowstart for selkokortti, some flashcard generating software based around my Finnish language news archive. The point of a Slowstart is to make it so that even absolute beginners can start to pick up some pointers about how people “in the know” of your chosen software ecosystem actually get things done. Instead of a Dockerfile or a shell script, you take them by the hand, spin up a totally fresh virtual machine from the ground up using something like Vagrant or virt-builder, and walk them through each and every command they need to execute in order to get to a working install. ...

June 4, 2024

I'm turning 30 so naturally I'm switching to OpenBSD

I’m kidding, I’m switching to OpenBSD because I like security or code quality or something. It’s totally not because the inexorable march of aging is starting to show its effects on my ability to down necessary-evil trivia like me and my friends used to down forties in the Ahhhnald after dark, and so I’d like to settle down with a software ecosystem I can study in real depth once without feeling like 20% of what I absorb in year X will be deprecated by year X+10. ...

May 4, 2024

Language learning treated as breadth-first search

I am, emphatically, not the language learning type. I’ve done enough of it over my life to know this. It’s certainly one of the better hobbies out there: You can do it for free (in principle), you can sink as many hours as you care to into it, and if you get good enough at it you get to reap some unique cultural and economic1 benefits. But there’s a reason I picked up Python when 14 year old me decided he wanted to get ahead in life instead of (say) German. ...

April 22, 2024