Fun With the Command Line

Lately I’ve been trying to learn more about Bash and command-line tools like curl and jq. It’s just fiddling around, but it’s fun and surprisingly addictive.

A few recent mini-projects:

You can’t spell “Toronto City Council” without “TTY”

Screenshot of the 2mmis.sh main menu and help

2mmis is a command-line interface for TMMIS, the Toronto City Council Meeting Management Information System. They revamped the site earlier this year; the front end still isn’t terribly impressive, but on the back end, they’ve implemented an (apparently undocumented) API that serves data in JSON format.

At first I thought about using it to generate simple static web pages with meeting and agenda data, but it was less complicated to make something completely terminal-based. It can show you monthly schedules, committee information, meeting agendas, and more. It’s just curl, jq, and a lot of printf statements, basically.

Party like it’s 1199

Screenshot of temporal-hours.sh help and clock output

Recently, with the clocks “falling back”, there was a lot of the usual Discourse on fedi (as I’m sure there was on other social media) about Daylight Savings Time and what would be better, and I felt compelled to remind people of how they did it in medieval Europe (among other premodern societies): the night and day were each divided into twelve hours, no matter how long they were. This meant that in more northerly latitudes, during the winter nighttime hours would be longer than daytime hours, and vice versa during summer.

It’s obviously completely unfeasible in this age of time zones and rapid travel, but just for kicks, temporal-hours.sh calculates the hour according to this system based on your geographic location. It uses jq and the SunriseSunset.io API to find sunrise and sunset times for your location, then just calculates the length of the night and day and divides each by 12. You can turn it into a little clock running in your terminal by calling it with watch, and be on medieval time all the time.

“Hacking” Metazooa

The Metazooa game screen appears "torn away" to reveal a diagram of the phylogenetic tree underneath.

Metazooa is a fun Wordle-style guessing game where you try to narrow down the mystery animal based on its phylogenetic relationship to the species you guessed. My only gripe is that the set list of species you can choose from is very biased towards mammals and vertebrates in general. Like, there’s three species of Equus alone (horses, zebras, and donkeys), but only four species of arachnids!

I tried looking at the various scripts to see how it worked, but they’re all heavily obfuscated. However, a list of all the common names you can guess, plus the scientific name of the mystery animal, is right there in the web page’s source code when you load a new game! So I put together this script which uses curl, grep and sort to load thousands of Metazooa practice games, grab each mystery animal’s name, and delete the dupes to produce a list of all the possible species. Then I plugged it into NCBI’s Common Tree generator to produce the complete phylogenetic tree. The repo also includes the complete list of common names and the scientific names they correspond to.


I’m just a beginner at this, so the code is not that good. If you see room for improvement or want to offer some helpful hints, leave a comment—or make a pull request or issue on Codeberg!

City as mental condition

The worst thing about Beijing is that you can never trust the judicial system. Without trust, you cannot identify anything; it’s like a sandstorm. You don’t see yourself as part of the city—there are no places that you relate to, that you love to go. No corner, no area touched by a certain kind of light. You have no memory of any material, texture, shape. Everything is constantly changing, according to somebody else’s will, somebody else’s power.

To properly design Beijing, you’d have to let the city have space for different interests, so that people can coexist, so that there is a full body to society. A city is a place that can offer maximum freedom. Otherwise it’s incomplete.

[…] This city is not about other people or buildings or streets but about your mental structure. If we remember what Kafka writes about his Castle, we get a sense of it. Cities really are mental conditions. Beijing is a nightmare. A constant nightmare.

—Post-detention, artist Ai Weiwei reflects on Beijing. Read the whole thing.

You or Your Memory: Candas Jane Dorsey’s Black Wine

The Mountain Goats, The Sunset Tree“You or Your Memory” (Lyrics.)

I’m afraid I can’t bring myself to write something appropriately reviewerly, like “Candas Jane Dorsey’s Black Wine is as dark and heady as its fictional namesake drink”, without copious eye-rolling; nor do I have the patience to give a proper synopsis as you can find in any review online, such as “It follows several generations of mothers and daughters who blah blah blah…”—see, I’m bored already.

Let’s start again. What I find most extraordinary about Black Wine on a technical level is what Dorsey doesn’t do. The narratives are tangled and non-linear, and it takes a while to work out how many women there are—one? two? many?—and how they are related. Not every character even has a given name. There is very little physical description. There are lacunae and episodes of amnesia and dissociation. The geography of her world—which seems to be a descendant of our own or maybe an alternate version of it—is deliberately vague and yet dreamily evocative: the sailor town, the trader town, the mountains, the dunes of Avanue. There is no map on the frontispiece. There are several different languages, but we don’t “see” them—they are all represented by English. All this is immensely refreshing to the sf/f reader jaded by the last fifty years or so of worldbuilding wankery, and even more remarkable is that it works.

But none of this tells you what Black Wine’s really about.

So let’s start over yet again. It’s about pain, memory, language, and identity. It’s about how the authoritarianism of the state reproduces itself at every level, down to the power dynamics of sex. (There is a lot of sex in the book, from incestuous sadomasochism to joyously easygoing tripartite bisexual handfastings to furtive fucking that can only be named what it is, “love”, in the secret sign language of slaves.) It’s about the self-perpetuating cycle of domination, control, and abuse. Most of all, though, Black Wine is about freedom. In Ursula K. Le Guin’s Tehanu—which reminds me in many ways of Black Wine—Tenar says, “I am trying to find somewhere I can live.” (Or something like that; this is from memory.) Similarly Ea says, “Only today as I sat in my bath did I realize that my whole life has been spent in the search for safety.” And the trader says of Essa, “‘She had to find a place to live the rest of her life. And she set out.’”

Anyone who has ever cut a parent out of her life, or tried to, or would if she could, or subconsciously kept a list of what she would grab if she had to run and could only take what would fit in one bag, or vowed never to raise children lest she pass on her family’s heritage, or abandoned everything to start over somewhere else, where nobody knows her, or ever gets the euphoric urge to walk away from her home and keep on walking, as far as she can—any such person will understand intimately what Black Wine is about. But Dorsey’s writing is so viscerally true and her world so gorgeously realized that—I hope—any reader will come to know something of these things, too.