Learning to Chef

05 April 2014

Over the last three months I've been learning how to cook with Chef. Prior to this I have stuck faithful to bash scripts for provisioning servers, and Chef/Puppet/Ansible/etc all claim to make this job a whole lot easier. Having now used Chef extensively, I can for sure say it does not make the job of deploying easier.

My first encounter with Chef was when working in a Vagrant box to deploy a simple Django app and a couple of email related services. The first thing I noticed when reading through the recipe was that each block could easily be written as a single line in a bash script - it seems like writing a lot of extra code because it's simply easier than writing it out in bash (with all it's pitfalls). Nonetheless I ploughed on and after a few weeks was writing my own Chef scripts to deploy other services. Then the real problems began.

One great feature of Chef is the ability to include other peoples recipes, taking away a lot of the hard work. However on multiple occaisions I've included recipes which either 1. no longer exist or worse 2. references packages/other recipes/files which don't exist. Not only is this frustrating to deal with, but trawling through Ruby's awful tracebacks is certainly not enjoyable. Finally is the attribute system, with a nice and simple fifteen(!) levels of attributes, which require some serious studying to learn by heart.

In my experience all of these problems result in one thing: a decrease in developer productivity. We're not fighting with wierd configs & bash scripts, but instead spending days debugging Chef code. I'm 100% certain I could bash-script deploy anything (including groups/multiple servers) quicker than I could with Chef.

Thankfully there are many other options, such as:

  • Bash: still my favoruite - extremely powerful & flexible, great for deploying/installing single machines
  • Fabric: is like an enhanced form of bash using Python
  • Ansible: great for keeping consistent configs across larger groups of nodes

pngquant vs pngcrush vs optipng vs pngnq

14 January 2014

A couple of days ago I saw pngquant appear on Hacker News. I'd never really looked in depth into image compression, and after reading up on the subject I scanned through the comments on HN, discovering a number of alternative png (and other formats) optimisers. So I decided to benchmark/compare pngquant, pngcrush, optipng and pngnq.


Images: I tested a number of different images, some of which you'd be insane to render in PNG and more that make sense. The images vary greatly in size, colors and alpha channels and should be a good test for each of the optimisers. To ensure a fair test I opened & exported all the images with Photoshop, to give them all a consistent encoding algorithm.

Optimisers: I used the latest stable copy of each: pngquant 2.0.1, pngcrush 1.7.70, optipng 0.7.4 and pngnq 1.1.


pngquant --speed 1 *.png
pngcrush <name>.png ../after/pngcrush/<name>.png
optipng -keep -o7 *.png
pngnq -d ../after/pngnq/ -s 1 *.png
Read more →

Work Life Balance

10 December 2013

The work-life balance has been discussed a thousand times over; there are hundreds of articles telling you that a good balance is essential for a healthy, fulfilled life and that we should all be careful of becoming overworked and stressed. In many ways I couldn't agree more, of course these things are essential and a good balance will improve both work and life sides of the equation. My problem is how I define work.

As a developer/engineer/programmer/hacker/what-have-you I find it hard to define what is considered work. Obviously my regular job counts, but what about side projects? Building things/websites for friends? Tinkering with hardware? Even reading Hacker News - am I working or am I 'life-ing' - does it depend on the article's subject?

Like any good dev I enjoy what I do, I love the challenge of solving problems in programmatic, logical ways and I love the ability to create something out of essentially nothing with relative ease. So if I choose to spend an evening coding rather than doing 'ordinary' home things does that mean I'm constantly throwing off my work-life balance? I don't think so.

For me the work-life balance is a non-issue, the only thing I should worry about is happiness. The key to life is to enjoy it, not balance it.