Brain Phrye

code cooking diy fiction personal photos politics reviews tools 

Gamifying tedious work

I’m currently implementing a client library for a REST API. There are around 150 endpoints and while I automated a lot of the code generation there’s still a lot to do.

To make that easier I decided to gamify it a bit. I wrote a little shell script to show me some progress numbers:

Read more


A really interesting talk. As usual, metrics are important - but also as usual, the right metrics are important. If you think metric X relates to algorithmic performance, you need to actually show that’s true. And just because it used to be true, times change and maybe it’s not true anymore. In this case the idea that counting compares and swaps would predict sort algorithm performance was wrong because branch prediction, and to a lesser extent cache, in modern processors has a noticeable effect of time. Read more


Started trying to do gitmojis for my commit messages. The idea is to quickly highlight what a change is with an emoji. It’s a neat idea, but old dogs need tricks to learn new tricks. To help learn this new trick I wrote this script to put gitmojis in my commit template message: 1 2 3 4 5 6 7 8 9 #!/bin/bash exec > ~/.gitmessage echo ":sparkles: New feature. Read more

Revisiting how to deploy ephemeral twitter

In my initial post on setting up my tweaks on Vicky Lai’s ephemeral, I made a manky shell script to do the deployment. I mainly did it because I was still a bit dubious about terraform. However for the past year I’ve gotten way more comfortable with it and used it in anger loads of times. It works rather well and seems to be improving at a good clip. Think of it as make but for infrastructure. Read more

FreeBSD ipfw Notes

Last week I wrote about fail2ban on FreeBSD. One note about that is that service ipfw restart seems to break all connections. This is frustrating / terrifying when you’re ssh’d into a machine and running that command. In my case I thought the box was inaccessible for a number of days before realising I could just reconnect (always test assumptions - advice I still fail to heed regularly). I’ve read a number of discussions about this, but the answer that seems best is in this answer. Read more


My primary memory of the diner was that is was brown. It was 1983 and interior design hadn’t fully shaken off the 1970s. Memory is odd. I remember the color of the diner, but not why we were there. I’m pretty sure it was for my great-aunt Cassie’s memorial, but that’s largely due to the timing and who was there. And I’m not really sure where it was - Concordia, Great Bend? Read more

Fail2ban on FreeBSD

I’ve come across a number of posts describing how to set up fail2ban on FreeBSD. Every damn one of them modifies a .conf file which is a fail2ban no-no. And the package in ports even tells you this: 1 2 3 4 5 6 7 8 9 10 Please do not edit the fail2ban.conf, jail.conf, or any other files in the distributen as they will be overwritten upon each upgrade of the port. Read more


I don’t tend to do much php but it comes up from time to time. The package manager for php is composer and it’s generally not in distro packages. So I wrote the following for my home dir to make it easier to get on the odd time I need it. This would go in ~/bin/composer 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 #! Read more

Systemd User

A while back I set up a CO2 sensor in my office. The setup requires a prometheus server to scrape it and a python script to get the data off the sensor and expose them for prometheus to scrape. I’ve been running it in two open terminals for several months now. You can upgrade Linux desktops without rebooting or restarting your desktop session for quite a while. Eventually though it will start getting kinda flakey. Read more

Brexit Timeline

This is a simple Brexit General Election calculator. It does not factor in public holidays. Enter the date and press return. Date No Confidence Vote proposed: Date of No Confidence Vote: Date to schedule election (14 days): Date of election (25 working days): Date of count (1 day): Date government formed (3 days): Some of these time periods are set in stone by the Fixed Term Parliaments Act (2011). Read more

Burren CO2

There have been a number of discussions about carbon taxes and reducing co2 generation in Ireland due to our likely failure to meet emission targets in 2020 and beyond. The Burren is a manmade landscape. Thousands of years ago the Burren was a forest - primarily hawthorn and pine. The people living here then likely spent generations clearing it for farming and then, without the trees there, the weather stripped the top soil away. Read more

Continuous Integration repo reminders - revisited

Back in 2017 I wrote about CI reminders. It was specific to 3rd party tools, but it turns out there are other use cases. It turns out my infrastructure configs have a number of things that I need reminding about. For web servers I need to know the latest recommendations for SSL configurations. More importantly I need to make the changes and check them. For terraform I need to review my provider versions and update them. Read more

Sensor, part2

The other day I was playing with a CO2 sensor. I think I promised to publish the changes I’d made to the original code and I finally have. I also included some of the files you’d need to install it. I’m not happy with the udev configuration. First the "add" line seems to cause several co2sensor@.service starts for different values of the %k format string. I’m not clear why. And the "remove" line doesn’t seem to work at all. Read more

CO2 Sensor

A while back I bought a CO2 sensor I could get readings off USB for. I finally deployed it in the office using a modified version of this and prometheus. I’ll write up the code bit later but the graph of the first two days is interesting. The initial, pretty flat bit is the weekend. And then people start coming in on Monday morning. One of the guys remembered to check it and then opened a window as we saw it was nearing 1,200 ppm. Read more


A while back I had some ssl fun. Amusingly that fix worked for exactly one week. The docker container that was being generated there was based on Debian wheezy. Apparently that was so old that not only was it deprecated, the next version seems to soon be deprecated too. So I’ve spent the last two weekends feverishly porting it to Debian stretch. I’m not really a Debian user for most things so I don’t follow their release ecosystem. Read more

Pyramid Power

When I was in school, I devoured school libraries. I read them all and there was some weird shit in some of them. In junior high school I remember several books in particular. They were a series of conspiracy theories books - but written by someone who seems to have believed them and written like they were all totally true. It seemed believable. And up till then, books were clearly fiction or not fiction. Read more


I ended up reading about zram today and decided to give it a go. The install process on Ubuntu (and I assume Debian) is simple: 1 2 3 sudo apt install zram-config sudo systemctl start zram-config cat /proc/swaps You should now see several zram devices. They’ll have a higher priority than the disk based swap. This means that they’ll swap in and out cheaper with a slight cpu/memory cost. Read more

Tabs v Spaces

A new angle on the tabs v spaces debate: how it affects your salary. Personally I’m a tabs and spaces person, but I’m pretty relaxed about it.

Father’s Day

My question before venturing off down the canyon to the right was whether to go barefoot or wear flip-flops. I was wonderfully unprepared for this adventure. However I was convinced by wiser people - my girlfriend, sister, dad, essentially everyone - that shoes would be wise. Though based on the dirt ground into the bottom of my t-shirt, perhaps wearing them on my feet was a mistake. Around the time we’d reached the bottom my nephew had managed to get into some difficulty and got stuck on the opposite side of the river at the bottom of the canyon. Read more

Vim CVE 2019 12735

Sigh. There’s a modelines vulnerability in vim that’s rather simple to exploit. Thankfully there’s a simple workaround - just disable that functionality. Add this to your ~/.vimrc and then it won’t affect you but you’ll get modelines back when fixed versions arrive. However there’s some question about the fix so might keep an eye out on this issue and adjust the if statement as appropriate. 1 2 3 4 5 6 7 8 9 " Disabled due to https://nvd. Read more