Skip to main content

Posts

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 Terminal.app 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.

Vim with Solargraph: autocompletion heaven.

·4 mins

UPDATE: just use coc.nvim; it’s much simpler.


I’ve long been in search of good Ruby auto-completion framework for vim, without luck. As soon as a new option comes about, I’ll jump on it, only to find that it either doesn’t work at all, or sometimes does its job at best.

Fortunately, we now have Solargraph. Solargraph understands Ruby code and does a great job of extracting pertinent information for auto-completion, documentation, and refactoring purposes.