Biking from Akatawara to Renata Hut (Attempt #2)

After my failed 2017 attempt to reach Renata Hut, I finally mustered up the spare time and inclination to have another shot. The TL;DR of the last attempt is that due to significant tree fall on the track, it took me too long to make it up to the Hut - I reached my cutoff and turned around. After that...

List filenames only with grep

Just a quick one - I use grep all the time to find matches for text in files. Sometimes I’m not really interested in exactly what matched, I just need a list of files that matched SOMEWHERE. This morning I found that the -l option with this (or --files-with-matches). From the man page: -l, --files-with-matches Suppress normal output; instead print...

Ruby: Deserialize JSON to an OpenStruct

Deserializing JSON from API responses, files and the like is a pretty common task. Depending on the complexity of the JSON structure, this can be a bit difficult to work with though, since the default action of JSON.parse is to deserialize to a string-key Hash. This means that after parsing the JSON, there’s a lot of fetching, diging, and the...

Exercism Strain: Collaborative implementation and benchmarking

This post covers an incremental implementation of the Exercism “strain” exercise that I worked on collaboratively with one of my colleagues at Ackama, Daniel Jauch. The Strain exercise brief is to implement keep and discard functions within an Elixir module named Strain, without using the Enum.filter module, for example: iex> Strain.keep([1, 2, 3], fn e -> e < 10 end)...

List memory usage per Unicorn worker

I have been using this snippet recently to show the amount of memory currently being consumed by each Unicorn worker. This is a convenient way of checking: The expected number of workers is being run The memory usage of workers is fairly uniform The average memory usage of Unicorn workers (if you are considering adding or removing workers) Here’s the...

My notes from Devops Days Wellington, Day Two

A little disclaimer: These notes are mostly for me to refer back to in the future, and are based on quick handwritten notes I took at the conference. They shouldn’t be used as a general reference since I may have misquoted, misremembered, or ventured an opinion that isn’t quite right. My DevOps ticket was funded by my employer, Ackama. DevOps...

My notes from Devops Days Wellington, Day One

A little disclaimer: These notes are mostly for me to refer back to in the future, and are based on quick handwritten notes I took at the conference. They shouldn’t be used as a general reference since I may have misquoted, misremembered, or ventured an opinion that isn’t quite right. My DevOps ticket was funded by my employer, Ackama. Moving...

Open all files as tabs in in vim

Just a quick trick I learned yesterday: I often glob files into vim from my terminal to view them quickly - for example, given the following files exist: > ls file1.txt file2.txt file3.txt When I run: vim *.txt Then I expect file1.txt, the first file, to be opened When I run the command :tab all within vim I then see...

RSpec's `have_attributes` matcher

I’ve been working on rewriting some legacy feature tests that have been unmaintained for several years as system tests. One of the most convenient methods I have found while creating these tests is have_attributes. The RSpec documentation I linked to above is a great overview of the matcher. I have found that it’s useful to matching the result of a...

Mitre Flats: Tararua Forest Park

This trip was a bit opportunistic, making the most of a fine weekend in late winter to start getting back into the Forest Park before the official start of the summer season! Mitre Flats is one of the more popular spots to visit from the Wairarapa side of the Tararua range, and has been on our to-do list for some...