Because I thought it was worth putting somewhere more public and permanent than a Mastodon post. If you already know the deal, skip to the recipe. Continue reading Branching Out: Some Github & GitLab.com Alternatives
Category: code
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”
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
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
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!
New CBC MP3 stream URLs
Rejoice, Winamp users, the CBC MP3 streams are back! Many thanks to commenter AJNorth for finding a list of still-working MP3 URLs, and GitHub user canuckken for providing the Wikipedia page with radio station call letters.
Once more, here’s the playlists with all the stream URLs on Codeberg, and see the original blog post for more details.
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.
CBC radio stream URL update
It’s that time of year again: the CBC has changed the streaming URLs for Radio 1 and CBC Music, so I’ve updated the gist. Ici Première, Ici Musique, and the MP3 version are unaffected. For more information about why and how to use these, see the original post.
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.
- It looks like ass.
- 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.
- Literally every software download site is super dodgy.
- The default user is administrator by default??? No wonder people get viruses!
- No fucking compose key! Continue reading The GTK+ Compose Key…for Windows
Theme: Markdown for Notepad++
A few months ago I got a new computer that has hardware with little Linux support, and so while waiting for someone to make a sound driver, I’ve been using Windows 10. I tried a lot of text editors, even building Gedit from source, before settling on Notepad++.
Notepad++ has built-in syntax highlighting for a lot of languages, but not Markdown. You can make your own “user-defined language”, and several people have created ones for Markdown, but I wasn’t really satisfied with any of them. So I made my own, which you can check out on Github. Due to the limitations of user-defined languages, some Markdown features can’t be implemented (e. g., asterisks as bullets, three spaces to create code blocks, etc.), but it should be good enough for everyday use. Please try it out, and adapt it for your own use!