Developing software in the Real World

Using Phive to manage PHPUnit

I recently came across the Phive project and have had a play with it. Phive is part of phar.io and is intended to manage development tools such as PHPUnit in preference to using Composer's dev dependencies. The main advantages of Phive are that it uses the phar file of the tool and only keeps one copy of each version rather than downloading a new copy into each project. How it works Phive stores one copy… continue reading.

SSH keys in macOS Sierra

Now that I've upgraded to macOS 10.12 Sierra, I noticed that SSH required me to enter my passphrase to keys every time I used them. This was a surprise as it's not how 10.11 El Capitan worked. This is how to fix it. Firstly, add your SSH key's passphrase to the keychain using ssh-add -K ~/.ssh/id_rsa (or any other key file). You can now use your SSH key without re-typing the password all the time… continue reading.

Using CharlesProxy's root SSL with home-brew curl

Once I installed Homebrew's curl for HTTP/2 usage, I discovered that I couldn't automatically proxy SSL through Charles Proxy any more. $ export HTTPS_PROXY=https://localhost:8888 $ curl https://api.joind.in/v2.1/ curl: (60) SSL certificate problem: self signed certificate in certificate chain More details here: https://curl.haxx.se/docs/sslcerts.html curl performs SSL certificate verification by default, using a "bundle" of Certificate Authority (CA) public keys (CA certs). If the default bundle file isn't adequate, you can specify an alternate file using the… continue reading.

Notes on keyboard only use of macOS

It's been a while since I could use a trackpad without pain and even longer since I could use a mouse or trackball. Currently I use a Wacom tablet as my mouse which works really well as long as I don't use it too much. Fortunately, keyboard usage doesn't seem to be a problem (yet?), so I try to use only the keyboard as much as possible on macOS (née OS X). These are some… continue reading.

Installing 32 bit packages on Ubuntu 14.04

This had me stumped for a bit, so I've written it down. If you have a 64 bit version of Ubuntu and want to install a 32-bit package, you simply add :i386 to the end of the package name like this:

However, this didn't initially work for me as apt-get couldn't find the package:

It turned out that my installation only had the 64 bit architecture configured which you can tell by running:… continue reading.

Git submodules cheat sheet

Note: run these from the top level of your repo. Clone a repo with submodules:

View status of all submodules:

Update submodules after switching branches:

Add a submodule:

Update all submodules to latest remote version

Update a specific submodule to the latest version (explicit method):

Remove a submodule:

or

Docs: Manual page on submodules Git book chapter on submodules LornaJane's guide to submodules

Routing specific traffic to the VPN on OS X

I have a client that requires me to use a VPN when connecting to their servers. I use OS X's built in L2TP VPN to connect, but don't want all my traffic going that way. To do this, I unchecked the Advanced VPN setting "Send all traffic over VPN connection" in the Network preferences and then created the file /etc/ppp/ip-up like this:

The file itself is a bash script that runs various /sbin/route commands… continue reading.

Provisioning with Ansible within the Vagrant guest

I've been setting up a Vagrant VM for use with some client projects and picked Ansible to do this. Firstly, I played with the Ansible provisioner, but found it a little slow and then I realised that Ansible doesn't run on Windows. Rather than migrate what I'd done to Puppet, Evan recommended that I look into running Ansible on the guest instead and provided some hints. This turned out to be quite easy. These are… continue reading.

Git push to multiple repositories

I have a couple of projects where I need to push to more than one repo all the time. I have been using this command line to do so:

However, I recently discovered that I can create a remote that points to more than one repository using these commands:

I now have a remote called all that will push to both repositories! There's no automatic way to go the other way and fetch… continue reading.

Context specific history at the bash prompt

One change I made recently to my .profile is this:

These two bind command change the way that the up and down arrow keys work once you start typing a command to only search the history for lines that start with what you've typed so far. This means that I type, say, git and then press ↑ & ↓ to go through all the times I've typed a git command without having to go… continue reading.