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!

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

Ninety-one years ago today

This afternoon I went to see Dave Meslin’s Fourth Wall exhibit, a gallery of ideas on improving civic engagement in Toronto, drawn from other cities around the world and our own history.

One of the most fantastic historical tidbits comes from the no-longer-extant Bureau of Municipal Research, a non-partisan organization that researched and produced reports about various city issues. This little pamphlet is from 1921. Mez has scans (page 1, page 2), but I wanted to transcribe it for accessibility’s sake.

Effective Citizen Co-Operation
What Is Everybody’s Business Should Be Each Body’s Business


Issued by the
Bureau of Municipal Research
189 1/2 Church Street, Toronto.
Telephone: Main 3620


Bulletin No. 84, January 7, 1921


Will 1921 Be A New Year In Civic Administration

OR

Will It Be the Same Old Year With a New Number?

Would the adoption of some of the following New Year’s Resolutions Make for More Effective Civic Administration?


For a Member of Council or Board of Education

  1. I will not speak on any subject unless I know something about it, and I will learn something about any subject on which I should speak.
  2. When I have said all I have to say of value on any subject I will stop talking.
  3. I will always confine myself to the subject on which I am speaking, and will not resort to personalities, no matter what the provocation, nor talk to the gallery, nor conceal my real sentiments in order to retain votes.
  4. I will keep my mind on the work in hand rather than keep my ear to the ground for tremors of dissatisfaction from interested quarters.
  5. I will vote on every measure that comes before the Council or Board, if necessary requesting the postponement of the vote until any required information may be obtained. I will not retire to the members’ room on the approach of a vote which I should like to avoid for personal or political reasons.
  6. In all my statements to constituents and colleagues, my yea shall be yea, and my nay, nay.
  7. I will treat the funds of the city as trust funds, and shall not suffer any of them to be appropriated, without vigorous protest, for objects not in the general public interest, no matter what the effect on my political fortunes may be.
  8. In dealing with the annual estimates, I will consider the best interests of the city as a whole, and will not resort to log-rolling, overt or tacit, and I will consider carefully the recommendations and statements of the official financial advisers of the city.
  9. Except in cases where the public interest requires it, I will protest against the conduct of any public business in private, either through the holding of private meetings or surreptitious meetings of cliques or factions to decide upon a course of action to be taken in public.
  10. I will speak and vote this year at the risk of it being my last year in Council or on the Board.
  11. I will not vote to upset the recommendations of any department head until such department head has been given every opportunity to defend his recommendation and, in my judgment, has failed to do so satisfactorily. Neither will I consent to any action being taken on matters requiring technical advice until such advice has been requested and obtained from the departments concerned.

For a Citizen

  1. During 1921 I will occasionally drop a note of commendation, commiseration or condemnation to my representatives in Council or on the Board of Education.
  2. I will not regard the interests of my ward above the interests of my city, and will not bring pressure on aldermen or trustees to secure special treatment for my ward or locality which would not be a benefit to the city as a whole.
  3. I will not ask Council to suspend by-laws for my personal advantage when it would involve a disadvantage to the city as a whole, nor will I support others in asking for such special treatment.
  4. In determining my actions as a citizen, I will obtain all the information possible, and then make up my own mind without outside dictation, on the ground that I shall be one of those who suffer in case of a mistake.
  5. I will study the estimates of the city as they pass through the various stages of amendment and adoption.
  6. I will try to do as much thinking about civic expenditures to which I contribute as about my private expenditures for services not paid for through the tax rate.
  7. I will not condone the brow-beating or contemptuous treatment of civic officials, while trying to protect the city’s interests, by any of my elected representatives, even if I may think such officials are mistaken.
  8. I will allow the results of my observations to affect my course when the times for nomination and election come around at the close of the year.
  9. I will be a citizen during 1921, not a parasite or mollusk, or piece of blotting paper.

Do you think the current City Council has been living up to these New Year’s resolutions? Would they agree to be bound by them in 2012? And how well are we doing at the whole mollusk thing?