James McDonald

Let’s Get Static

I migrated this site to use static generation, specifically with Hugo. I’ve been thinking about doing so for a while, but switching seemed like it would be a giant hassle. I exported from Wordpress with https://github.com/SchumacherFM/wordpress-to-hugo-exporter, which appears to do a bloody good job, including making all the old URLs match up. So that was super easy. Read more →

Docker swarm monitoring

I’ve seen a bunch of posts lately about how to set up Docker swarm monitoring with tools like cAdvisor and node_exporter which advise running them like this: docker service create --mode global -p 9100:9100 ... That will indeed run one container on each swarm node, but it has a subtle problem. When you connect to host:9100, the ingress network routing will connect you to a random instance each connection (for swarm routing values of random). Read more →

Git post-receive hook for Puppet control repo updates

I made a fairly simple post-receive hook setup to automatically update my Puppet master when I push changes to my control repo. I keep the repo in gitolite, so I wanted to use a regular git hook rather than web hook magic (or even magicer Puppet Enterprise Code Manager magic). My control repo itself is based on the puppetlabs control-repo on github. Essentially the idea is that every branch in the repo becomes a Puppet environment on your master, complete with automatically updated modules based on a Puppetfile. Read more →

Function for bash or zsh to generate SSL requests and certificates

Rather than memorising annoying OpenSSL options, stick this in your profile, edit the ‘SUBJ’ bit, and you’ll be generating keys with ease. # Generate an SSL key and a signing request or self-signed certificate sslcert() { cn=$1 # The prefix for the certificate's subject, eg # SUBJ="/C=GB/ST=Edinburgh/L=Edinburgh/O=Widget Co" SUBJ="<<< SET THIS BIT >>>" if [ -z "$cn" -o "$cn" = "-h" ]; then echo "usage: $0 <common name> [csr|crt]" >&2 echo " Read more →

Import Things tasks into Apple’s Reminders

OK, so I was making a list of things to do today, but then I decided that having created them in Things, I wanted to move them to Apple’s Reminders. Don’t ask – I’m a task list fetishist. A neat trick you can do with Cultured Code’s Things is to select a bunch of tasks and drag them to a text editor, which will create one line per task with any note appended in brackets. Read more →

Vag klokke

I localised my awesome fuzzyclock.py script to Norwegian language and, uh, regional time-reading standards. Behold the glory of vagklokke.py! A little terminal in the top right of my screen now proudly proclaims: <br /> Datoen er 2012-11-13<br /> Klokka er fem på elleve<br /> It was fun to work out how to handle “x på/over halv” without too many horrible range conditions. I haven’t bothered to remove stale things like ‘tjuefem’ from the minute list, because it ain’t broke. Read more →

Hardcoded GNOMEish composition

From Ubuntu docs about the Compose key at https://help.ubuntu.com/community/ComposeKey: The compose key sequences used by Gnome are derived from the X compose tables of XFree86 version 4.0 with further modifications to provide a Gnome standard for all locales. They are hard coded into the program in source file gtk+-2.10.7/gtk/gtkimcontextsimple.c Digging into the current Debian gtk+ source verifies this: <br /> /* This file contains the table of the compose sequences,<br /> * static const guint16 gtk_compose_seqs_compact[] = {}<br /> * IT is generated from the compose-parse. Read more →

Diablo III EU “Error 33” Fix

If you had the Diablo III beta installed, you might come across error 33 “battle.net is down for maintenance” while trying to log in. This is because there is an old registry setting pointing at the US rather than EU login server. Take a look in HKEY_CURRENT_USER\Software\Blizzard Entertainment\Battle.net\D3. I solved this by deleting the entire ‘Blizzard Entertainment’ key. From orbit, just to be sure. Works like a charm. Read more →

How to find our flat

As our building is a bit of a maze, we thought it would be useful to tell you how to find the flat. There are two exciting ways to get here, but this is the easiest to follow. First, go to Øvre Storgate 1B. You can find it with Google Maps. Press buzzer 4A. Wait for the nice people to let you in. You find yourself in a hallway. There is a welcoming door here. Read more →