Skip to main content


Powering a Windows PC via HomeAssistant

·6 mins

I have a PC hooked up to the TV in our living room, which is used primarily for Kodi and video games. I’m using a Logitech Harmony activity to switch the TV on, power the AV receiver, change to the PC input, etc. The only problem is that there’s no way to turn on or off the PC via Harmony, so I often sit down and forget to turn it on, or go to bed and find that it has been running all night. Inconvenient and a waste of energy!

Thankfully, we can use HomeAssistant to bridge the gap, but there are a few pieces to the puzzle.

The Case of Growing Disk Usage with Logrotate and Sidekiq

·2 mins

Here’s a quick one.

One of our servers recently experienced an issue in that its disk usage was consistently growing to illogical, unmanageable proportions. This would trigger an OpsGenie alert and wake me up, so in a groggy state I’d delete some extraneous log files (we log a lot), promise myself to look into it tomorrow, and go back to bed.

I don’t have the best of memories at the best of times. This happened a few times before I looked into the problem.

First I thought we were just logging “too much” — actually we require pretty extensive logging, so my proposed fix was to be increasing the server’s disk space — until I saw a massive difference between the output of sudo du -h --total --max-depth=1 / and df -h --total / — a 14GB difference on a 25GB server.

Syncing HomeAssistant With GitHub

·3 mins

I use HomeAssistant for my home automation needs. It does a fantastic job, but does require regular editing of config files. Although we can install vim on the server, I’m much more at home editing on my local machine, so I was in search of an easy way to keep config files in sync.

There are a whole host of ways to achieve this, but I settled on what I think is the simplest: a git repository hosted on GitHub. Rather than setting up a git server on the HomeAssistant machine, it’s simpler to manually pull to keep things in sync, but a little less convenient. With a little tweak, though, it works perfectly. Here’s a quick walkthrough.

NeoVim everywhere on MacOS

·3 mins

To those of us who have embraced editing text in vim, working on anything longer than a sentence outside of vim becomes rather frustrating. This means we’ll often open up vim, write our thing in there, and paste it back into the original text control.

But there are better ways. After much trial and error — and with the help of various findings on Google — I’ve created a couple of Automator scripts to make working with vim on MacOS less chafing. The following assumes NeoVim and iTerm2, but porting to regular vim and should be fairly simple.

Testing APIs in Ruby: An overview

·7 mins

Having written a number of API clients in Ruby, I’ve often run into the problem of testing them. We can assume that the API will return the results specified in their documentation, but we’d still like to see what our API client returns; this may differ considerably from what the API itself returns.

The last thing we want to do is hit the actual endpoints: this is slow, may incur rate limiting, the server may be down at test time, endpoints may change, and it’s just not cool to hammer an external service.

This is a little round-up of approaches I’ve had success with.