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 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 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, calculates the hour according to this system based on your geographic location. It uses jq and the 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!

CBC MP3 stream URLs down

Another update on the CBC radio stream URLs: as various people have kindly let me know, the MP3 links are down, probably for good. The M3U8 links still work, and most modern apps and devices should be able to handle them. However, I’m afraid legacy users are out of luck. Update, July 30: the MP3 links are back!

I’ve also moved the repo to Codeberg; however, the changes should be automatically mirrored on Github.

For more details, see the main blog post.

How to Choose a Mastodon/Fediverse Server

Featured image by, via Wikimedia.

In a previous blog post, I recommended some Mastodon servers for people moving to the Fediverse. Since then, the great migration of November 2022 happened, and an awful lot of those servers turned out to be horrifically ill-equipped for the increase in users. I don’t mean in terms of technical infrastructure, but governance and moderation.

So instead, I’m going to talk about what to look for in a server, rather than recommending any particular ones. Continue reading How to Choose a Mastodon/Fediverse Server

Update: CBC Radio stream URLs

I’ve updated my post on CBC Radio stream URLs after someone found links to MP3 versions of the streams. I’ve put together a second playlist which will work for older applications like Winamp that don’t support HLS. Yes, there are multiple people out there still using Winamp. I guess it really does whip the llama’s ass.

CBC Radio Stream URLs

Update, July 30, 2023: Repo is now on Codeberg and mirrored to GitHub; new MP3 links added.

Recently CBC revamped its music streams again and the old MP3 stream URLs don’t work. Why would they do this? Well, they want people to listen using the website or official app, or via platforms they have agreements with, like Google Home and Alexa.

Personally, I think this is bullshit. I like listening to music while on the computer, but I’m not opening a whole-ass modern web browser, on top of whatever else I have open, for a simple audio stream. And if I’m using headphones with my phone or an actual physical radio, how am I supposed to hear sounds on my computer? So, after some helpful tips from more techy folks on Mastodon and Github, I threw together a few playlists of the live radio streams. Continue reading CBC Radio Stream URLs

The TRC Report, Online

So I thought I’d share what I’ve been working on on the side: an online version of the Truth and Reconciliation Commission report on Canada’s residential schools. The TRC report is a vital resource that weaves together survivors’ testimony and historical records into a thorough, authoritative account of how the government and the churches used residential schools as a means of destroying Indigenous families, languages, and cultures. It’s a part of history many Canadians know very little about. Continue reading The TRC Report, Online

The GTK+ Compose Key…for Windows

So last year I got a netbook with rather poor Linux support. I finally got elementary OS working on it (a blog post in itself), but for the past several months I was using Windows alone. And it was terrible, for many reasons.

  1. It looks like ass.
  2. Mobile and desktop elements are mashed together awkwardly and it just doesn’t work. A desktop user should never see a message telling them to “swipe down” to continue shutdown. Jesus.
  3. Literally every software download site is super dodgy.
  4. The default user is administrator by default??? No wonder people get viruses!
  5. No fucking compose key! Continue reading The GTK+ Compose Key…for Windows