Mac Chapman

Software engineering leader and platform engineer

Consolidating Environments in Ansible

A recent project I was working on required that we deploy the same web application in a fairly high number of environments - around 10. Each environment was supposed to be more or less the same, with a few tweaks, and they were completely separate. These environments had grown organically and as such they weren’t uniform - they didn’t have a common deploy method, file layout, or even infrastructure layout. ...

June 2, 2020

Lessons from Lead Developer London 2019

This week I was lucky enough to get to Lead Developer London 2019, an amazing conference on technical leadership. I’ve been a few times before and every time I go I’m completely blown away: it’s an absolutely brain-melting single track conference jam packed with the most thought-provoking presentations. I believe that when you go to a good conference, you always hear exactly what you need to - what you learn is a personal thing. Here’s what I picked up on and the talks that really resonated with me. ...

June 13, 2019

Make Your Code Really Boring

This blog post is adapted from a talk I gave at PyCon UK 2018. You can find the talk here, and the slides here. I’ve been developing software professionally for over 10 years, and I’ve made a lot of mistakes. A lot of those mistakes were down to me trying to do something a bit too clever and a bit too exciting when it should have been simple, so I’m going to work through some techniques I’ve learned the hard way for making things nice and boring. ...

February 1, 2019

Looping in Ansible Evaluates Things

I recently came across a bit of an unusual situation in Ansible that I haven’t had much luck googling, so here’s something to help the next person. I was trying to loop through a series of dictionaries, running a task with each dictionary defining the majority of the variables that the task would use. I had some global variables, some that varied from dictionary to dictionary, and some that were defined inside the task. I wanted to reference the variables in the task scope in my dictionaries - so, in my dictionaries I had a template for a deploy directory. It would be used multiple times with different values in the variables it references. ...

August 6, 2018

Unity3D, Vim and YouCompleteMe

Recently I had some issues getting these three wonderful things to play nicely together, but I got there. You need mono installed, and you need to install YouCompleteMe with clang and omnisharp. Here’s what I did on OSX: brew install mono cd .vim/bundle/YouCompleteMe ./install.py --clang-completer --omnisharp-completer

November 16, 2016

SSL Certificate Transfer - Digging Out Public Keys

Say you’ve got a client and a server. The server is running SSL, so it has a certificate stored in a .pem file, which looks a bit like this: -----BEGIN CERTIFICATE----- MIIC1jCCAb6gAwIBAgIJAMQrHtnBwK9KMA0GCSqGSIb3DQEBCwUAMCMxITAfBgNV BAMTGHZhZ3JhbnQtdWJ1bnR1LXRydXN0eS0zMjAeFw0xNTA2MTExNDIxNTNaFw0y NTA2MDgxNDIxNTNaMCMxITAfBgNVBAMTGHZhZ3JhbnQtdWJ1bnR1LXRydXN0eS0z MjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALuRUDnqMVAJwy2qm96O bIuCeX+Dh/sooMak/ZrVbswgZSXL6uT5M/VPnX/rBihMESCf8nB27VRXYAgM88Wk ZEBpXKpuwIDzN9+fdj4n6WGYZnQx75ODGHx5ukbacH93Eftg2kfliRZXOnGKLJV1 hU6oazB8lSP1ZeYpGXW+v9GFSd9MJPHapI5mQzdtwFftaGDdLsMpo7tAvU1snYcQ gKu68cEFmEUyLey0EWpeoYOUNjFdrvROKACVGy3ViIOlIEEWVWFYKVvzxlMG8l8J 5AlqRe/X3Vg1GqbmBLzj9TyuYIUt4b2HbvaPvdQYr1UX7D/XWI3QaE5qsxc3E+X+ vhsCAwEAAaMNMAswCQYDVR0TBAIwADANBgkqhkiG9w0BAQsFAAOCAQEAoAEz5bXJ vRAR7ZJKlSDkOGmnUkaDFFkORSV7TwCgA4NQctxEETD72IFSGhMniIsrsplE0J45 L8+HsL91vP1qqYSs18TDAtMCcg4ZSlyz59cFCBYpy4LamZIiDYwi01T3ZfGZdkm3 TIjJVpG8H9Q86Q2LaYs9ij9Dy1MIMwAkEREt4UvvByA8/a1HqmXMoCJCWps9UUgQ PmFT0oZWvxDecgayIpaURAsausWwUy/1fNTFwURpLO7U6vS5F+tt+UNLS1J50mss 88O5YLOlU/VE08jobKPnJL874XB52vfFvm9fyKSKVGB3x1susPduzVES4lRoRWZG 9Etek9wLpapsAA== -----END CERTIFICATE----- And when the client connects, it receives the certificate and can validate it, right? Recently I found myself in the odd position of needing to write code to view the contents of the certificate on both sides of the connection and obtain data from them. It didn’t occur to me, until now, that I know absolutely nothing about that block of data, there. I guessed it was base64 encoded, but beyond that, it was a total mystery. ...

June 15, 2015

The Regex Resource List I Need

I use regular expressions a lot, but not quite enough to remember everything they can do every time I need to do it. Every single time I use them, I forget about one of the resources I usually use to look things up, and regret that I never took the time to write them down. Time to fix that. http://regexper.com displays your regex as a finite state machine. Invaluable for figuring out how a complicated regex ticks. http://regexr.com allows you to enter a piece of text and see how your regex interacts with it. The Java Documentation for Pattern seems to still be the best single page for regex syntax. Obviously there are minor differences based on which language you’re using, but most of the time, what you’re looking for is on this page. Regex 101 is a mashup of everything else on this list. What a powerful tool!

May 24, 2015

An Edge Case Concerning Python Global Variables

A colleague of mine just came across a rather interesting edge case when working with Python global variables. Of course, most of the time, you should just try to avoid them altogether, but if you do use them you might come across this. If you have a global variable, and you assign to it in a function without using the global keyword, your code will fail to compile. This can result in a confusing error message. Here’s a simplified example: ...

January 28, 2015

i386 Docker Virtual Machine-like Containers in Vagrant

There are plenty of reasons why what I’m trying to do might be a bad idea, and I won’t bother to go into them, but suffice to say that I know that Docker isn’t really about virtual machines that persist, and I know that it doesn’t really like running on 32-bit machines. That said, I had a linux VM and a Vagrantfile that could spin up a build environment for a project, and I wanted to try out Docker as a Vagrant provider, so I did. It was messy, but it worked, sort of, so here are my notes, in case they help someone else. There were a lot of bits of this investigation and I’ve done my best to lay them out in the right order. ...

October 3, 2014

SQLAlchemy Relationships as Queries

Coming from a rails background it seemed a bit odd to me that a relationship doesn’t create a query that you can continue to work with. That might sound a bit odd, so let me show you what I mean: Don’t worry though! If you set your relationship to be dynamic, your relationship will always be returned as a query object, that you can continue to work with. This enables queries like “Find all the addresses that match this criteria from this user”. ...

November 10, 2011