› Dan Peterson

Hi, I’m Dan. Usually danp.
Halifax has a systemic road safety problem. One way it manifests is people driving too fast, especially on residential streets. Recently, Halifax Regional Council mostly approved their 2021 capital budget. It includes $1 million for traffic calming and the final budget may include $1 million more. Read more about that here or here. The city publishes a ranked list of approved requests. Not all requests are approved due to rules that contribute to the systemic problem.
As part of Heroku Private Spaces we attach extra Elastic Network Interfaces to instances, and we do that in Go with aws-sdk-go. The process isn’t the most idempotent and we recently discovered we were occasionally leaking ENIs. This could happen if we created an ENI and then encountered an error later in the process, such as when attaching it to an instance. I set out this morning to find a better way.
One of my favorite localized Go refactorings is reducing nesting by using return as early as possible. Take this example, based on a recently-refactored function at Heroku: func example() error { if err := start(); err != nil { existing, err := fetchExisting() if err != nil { return err } if existing.IsWorking() { return nil } else { return errors.New("found existing but it's not working") } } return nil } This can be hard to follow due to nesting inside if .
At Heroku we use Travis CI to run project tests on push to GitHub. While Travis CI offers PostgreSQL in their environment, it’s version 9.1. A project I’m working on recently started using PostgreSQL 9.2’s JSON data type, which 9.1 does not have. Needing 9.2, I searched for ways to make it available in the Travis CI environment. I found guides that suggested upgrading PostgreSQL in a before_script but I didn’t have much luck with that approach.
Since July 30th, I’ve been using ledger (on GitHub) to track my personal finances. What did I use before? I’m ashamed to say nothing beyond my banks' sites. I stumbled upon ledger via this blog post, linked from Hacker News. It took me a while to try it, for a few reasons. First, I had a weird notion that there would be a better time in my various “fiscal cycles” to start using such a thing.
« Older posts Newer posts »