Stuff that was hard to find, plus stuff I didn't have anywhere to put

Measuring the bow length of a recurve bow — May 6, 2022

Measuring the bow length of a recurve bow

Lots of conflicting information, and no simple diagrams. Much talk of avoiding the belly and following the curve, but actually you only follow half the curve. It’s hard to visualise from text alone.

The AMO bow length is measured along the red line I have drawn on top of this photo. The bow has no string fitted.

Fairly logical once you know – follow the path the string would if it was long enough not to cause the bow to be under any tension.

I’ve also seen conflicting information as to how much shorter the string should be than the length. I’ve seen both 3″ and 4″ quoted. My strings are marked “for 62″, which is what this bow’s length is. They actually measure 59”, but they have been used a great deal, so they have probably stretched to that length. The agreed manufacturing standards are that strings are marked with the bow length they are for, rather than the length they are. Just check with the merchant it before you buy it.

Printing UK number plates with a laser printer — March 3, 2022

Printing UK number plates with a laser printer

We’ve recently become registered number plate suppliers in the UK. We acquired the roller jig from the business next door who was giving up. Their printer was leased at some ridiculous monthly price (£80, I think?) for the printer and the software. I could see it was a standard HP P1102 laser printer, so I set out to buy my own printer and see if I could get it printing a number plate without the special software. I succeeded.

Note: if you supply number plates to the public you are legally-obliged to register. Manufacturers of the components needed to make number plates will not provide supply you without this registration. This information is intended for those who have already registered and want to stop paying a silly amount of money for their number plate printer. It might also be useful for people trying to print on other unusual sizes of paper.

The niggle for some of you might be that I did all this with the print server software CUPS which is built into all modern Linux distributions. For me this is a bonus, as we don’t have any Windows in our organisation. You will either need a Linux computer to print from, or possibly a print server running CUPS on a Raspberry Pi or the like, in order to follow these instructions. Certainly you will the need the help of someone who is IT-capable.

There follows a high-level description of what I did and learnt, rather than a set of instructions. I didn’t write anything down at the time, thinking no-one else might use what I did, so this is my best recollection.

1. Buy a printer

I had some concerns that I didn’t know what roller clearances, feeder behaviours etc. would allow a printer to handle and print on the very thick Nikkalite number plate reflective backings I had, so I bought almost the same model as I had seen the business next door using, the HP P1102. I bought the P1102W, which is a different colour and has wireless. I bought it second hand for £85 (they aren’t made any more). You will definitely want the wireless functionality – keep reading to find out why. This is a black only printer because I don’t care about country flags and other such nonsense, but you can probably use the information below to adapt for another printer. You can use it to print green EV plates – I lay a square of green adhesive vinyl over the left-hand side after printing. See below.

2. Get the right toner cartridge

My second-hand printer came with a partially-used cartridge installed. It was a remanufactured original HP cartridge from It worked for printing on number plate backings but it had resulted in a number of print artefacts. After trying a number of cartridge cleaning techniques I decided to replace it, and bought the cheapest aftermarket cartridge on Amazon (£10 each). These worked beautifully on paper (what a bargain!) but could not print on number plate backings:

Remembering that the first cartridge was an HP-original, I bought an HP cartridge instead (£55). The results speak for themselves. I would love to hear from anyone who knows why this is.

3. Check it works

First I wanted to check my second-hand printer works on paper. I did these things:

  • Plugged into my Linux Mint desktop via USB
  • The printer wasn’t recognised. Worked out that this is because the printer presents itself as a storage device until it gets some magic signal from the Windows driver (“Smart Install”)
  • Booted into Windows
  • Installed HP’s utility for disabling Smart Install and used it to “successfully” disable it
  • Re-booted into Linux
  • Printer still being presented as a storage device. Fuck HP. Fiddled around for a while and then gave up when I remembered it had wireless. (Would love to hear from someone who has this printer working on Linux over USB)
  • Re-booted into Windows
  • Installed HP software for the printer
  • Configured the wireless
  • Printed a test page over wireless on Windows
  • Re-booted into Linux
  • CUPS auto-discovered the printer on the network
  • Printed a test page over wireless on Linux

4. Create a custom PPD

My next challenge was to get the printer to print on UK number-plate-sized paper. I cut some paper out the same size as a number plate backing as the backings are expensive. Clearly I would have to specify the page size as narrow and tall and then print rotated so that the long backing could feed through the printer.

After much experimentation I discovered that:

  • The printer will printer on any size the driver (Windows or Linux) accepts
  • The Windows driver has the ability to specify custom page sizes
  • There is an internal limit in the Windows driver limiting the maximum page height that you can specify as a custom page size, which is smaller than the height printer can actually handle (Fuck HP)
  • This limit is too low to be able to specify the size of a UK number plate
  • Thus you cannot use the HP-provided Windows drivers. Presumably the company supplying the printer for £80/month provides some third-party, custom or generic driver without this limit
  • The Linux printing system also has the ability to specify custom page sizes and doesn’t give a monkeys how big a page you specify. Huzzah!

Presumably with a little more patience one might be able to try a bunch of different Windows drivers and find one that does accept this page size. Comments welcome. Another possible route is that there are some CUPS-alikes for Windows – you could potentially install one of those and use the PPD I modified?

The Linux printing system in use on Mint (CUPS) relies upon PostScript Printer Description (PPD) files to understand what a printer is capable of and what page sizes it can accept. These are plain text files so we can easily modify them.

When CUPS auto-discovers a printer and installs it for you as it had for me, it places a PPD file in /etc/cups/ppd – in my case /etc/cups/ppd/HP_LaserJet_Professional_P1102_Open.ppd

  • cp /etc/cups/ppd/HP_LaserJet_Professional_P1102_Open.ppd /etc/cups/ppd/Numberplate1.ppd
  • Modify /etc/cups/ppd/Numberplate1.ppd to add the new page size
  • Add a new printer manually and specify the modified PPD, with a different name to the auto installed printer.

Having done that I had a working printer entry which knew about the new page size.

5. Test document printing at number plate size

I had thought that perhaps I was on the home straight at this point, but there was much fun still to be had with how different programs print, creating various fit-to-page, margin and rotation issues. Here’s the workflow that succeeded in the end:

  • Install a UK number plate font
  • Use Scribus (which is free) to design your number plate with a page size of 520mm width and 111mm height. See the rules
  • Export your design from Scribus as a PDF
  • Open the PDF on Foxit Reader (which is free) on the computer you are printing from
  • Print
  • Select your number plate printer. The auto-rotate feature should mean that the plate is now shown in the preview window as printing vertically as you would wish.
  • De-select Fit to Printer Marg
  • Send it to the printer.

I will provide template Scribus files which meet the rules for EV and non-EV number plates for anyone who can produce their registered number plate supplier certificate. I created EV number plates by buying a roll of 300mm x 1m Ritrama Mediumself-adhesive matt vinyl in medium green. I shoved the digits over to create space for the green flash, printed, then laid the vinyl over the top and trimmed around the edges. Then put through the press as normal. I bought this item.

Good luck!

Controlling an EV charger from Home Assistant — May 25, 2021

Controlling an EV charger from Home Assistant

This post describes how I integrated a Sonoff Basic wifi switch with a type 2 QubeEV charger controlled by Home Assistant. You can likely use the information to integrate remote control with other charger types, and with other automation systems like SmartThings, OpenHab or Domoticz. Obviously you can also use a ZigBee or Z-Wave switch or whatever, I just chose the Sonoff because it’s dirt cheap and relatively small.

I have a QubEV type 2 charger from EV One Stop. It was the cheapest charger I could find at the time at £225ish not including RCD which I had the electrician include on the distribution board as an RCBO since a new breaker was required anyway. This charger is dumb. It’s just on all the time, with no timer controls to take advantage of cheaper time of day tariffs available to EV drivers now. Fine if you have timer controls on your car, but my EV doesn’t have a charge timer. Also, the charger is exposed to the street and has no locking functionality, so I wanted to take control of whether it was enabled or not.

Don’t follow this guide if you don’t know what you’re doing with mains supply. Fortunately this charger is really simple on the inside:

You can see the supply wires run into a junction box which feeds the controller (which talks to the EV to establish a charging session and turns on the contactor), and the contactor which switches the supply to the output socket. The plan was simple – run the supply wires for the controller through the wifi switch. If the controller has no power the contactor won’t be activated. You can likely identify the same components and wires in your charger – the incoming supply will split off to power the board or controller somewhere. Just interrupt that supply with the wifi switch and Bob’s your uncle.

WARNING: You cannot use the wi-fi switch to interrupt the switched supply that goes into or out of the contactor. The contactor has two smaller wires which control it, and two thicker wires in and two out that are the supply that goes to the EV. Those thicker wires will be carrying up to 40A and will simply blow up the wifi switch or start a fire. You may be able to interrupt the contactor control wires, but it will be simpler (and reduce the power consumption) if you switch the controller instead.

WARNING: The Sonoff Basic is not fused. You should strongly consider adding a fuse to it before using. Plenty of other posts on the internet to show you how to do that.

With that out of the way, here’s what I did.

Preconfigure wifi switch

Start by doing whatever you need to do add your wifi switch to your home automation system and check it works. In my case I flashed the Sonoff with Tasmota and then configured it with MQTT to connect to Home Assistant.

Test which wires you will be interrupting

I disabled the charger by switching off the breaker at the distribution board. Looking at the wiring layout, I found the live and neutral supply to the controller, then removed the live and restored the power to the charger with the car plugged in. As expected the car did not charge – in fact the LED on the front of the charger didn’t light either. Great – I’ve confirmed the right wires to interrupt to disable the charger. Power off again.

Controller supply interrupted and confirmed not working

Extend controller supply wires and connect to Sonoff

I removed live and neutral cables going in to the controller, and connected them to the in side of the Sonoff. I had to extend them slightly in order to wedge the Sonoff into the bottom of the case.

Then I cut a pair of wires the same thickness as the ones I have removed from the terminal, and ran them from the Sonoff output to the controller input where I had previously removed wires. Switched it back on, tested all OK and closed up the case. There’s not much space for the wires running into the socket, so a little jiggling was required.


Finally I set up automation in Home Assistant to power on the charger between 02:00 and 06:00 when we have cheap electricity.

The Sonoff Basic doesn’t measure power throughput so you can’t report on the charge rate, but this charger has a charge rate switch on the side so I pretty much knew what the rate would be anyway. If you used a device that did report this, then you would be reporting on the current consumption of the charge controller, not the current flowing to the EV.

Have fun and try not to zap yourself.

Zero pad numbers in Zapier — February 4, 2021

Zero pad numbers in Zapier

To zero pad a number in Zapier, select the action Code by Zapier, and choose Run Javascript. Set the INput Data to number, fill it in with the value you want to pad, then add this code:

output = [{ padded: ("0000" + inputData.number).slice(-4)}];

Obviously adjust the number of zeros as appropriate.

Ansible aws dynamic inventory groups; putting hosts into multiple groups — April 22, 2020

Ansible aws dynamic inventory groups; putting hosts into multiple groups

You can use the aws_ec2 inventory plugin for Ansible to create your inventory dynamically from EC2. This is very useful when you start using spot requests and auto-scaling groups and therefore don’t necessarily know what your machines will be called or when they will change – when our infrastructure starts to become more dynamic.

This plugin has a feature to add hosts to groups in Ansible based on tags on the instances, which is great. If for example you have a tag in each machine called AnsibleRoles then you set this in your something.aws_ec2.yml file:

- key: tags.AnsibleRoles

it gets you this:

$ ansible-inventory -i prod.aws_ec2.yml --graph
| |--arthur
| |--percivale
| |--lancelot
| |--arthur
| |--lancelot
| |--percivale

Those groups were created automatically based on the value of the tag attached to the instance. Great, as long as each server only has one role. What if web is on the same server as mail? You want the host to be in both groups so that both roles are applied when you run Ansible. The docs make it look like they’ve got this covered:

# Create a group for each value of the Application tag
- key: tags.AnsibleRoles
separator: ','

So now I could set my tag to “web,mail” and get both roles applied, right? Err, no. Instead you get this madness:

| |--arthur
| |--lancelot
| |--arthur
| |--lancelot

So now your playbooks have to target a group called web and a group called web_mail? No thanks. Here’s the hard to find way to do what you really wanted:

- key: tags.AnsibleRoles.split(",")
separator: ''

gets you:

| |--arthur
| |--arthur
| |--lancelot
| |--arthur
| |--lancelot

More intuitive, and more flexible for accommodating the shifting of roles between servers. The default separator is underscore, so you need to specify it as the empty string to prevent the group names being prepended with an underscore.

LUKS without LVM (for Dropbox) — October 7, 2018

LUKS without LVM (for Dropbox)

Since Dropbox fucked us all over by dropping support for filesystems that aren’t ext4, all the cool things you used to be able to do like encrypting your home folder dead easily with ecryptfs, snapshots with btrfs, LVM etc. are all stuffed. Now the OS must only see a pure ext4 file system, otherwise the Dropbox client will detect it and refuse to synchronise.

There is a solution using loopback mounting to create an ext4 specific to Dropbox; that’s fine but it means you are setting aside a certain amount of space to dedicate to Dropbox, and if your Dropbox gets bigger than that you’re going to have a pain resizing it. Instead I wanted to encrypt the root partition as well, and I want the simplicity and flexibility of one home directory not carved up into special partitions for Dropbox. So this is how I used LUKS to encrypt all my partitions, but without putting LVM in the middle.

This was tested with Mint 19. Should work on Ubuntu and probably Debian.

Intended audience


  • Have some experience with Linux so don’t need total hand holding
  • Don’t want to run a script to configure all this as you want to see/learn what’s going on
  • Aren’t in super-paranoid security mode
  • Want to dual boot
  • Not bothered about hibernation
  • Happy with a swap file instead of a swap partition (default in recent ubuntus)

Windows preparation


  1. Boot new laptop into Windows
  2. Perform all Windows updates
  3. Perform all manufacturer driver updates, especially BIOS
  4. Create a recovery drive (allows us to delete the recovery partition and get that space back)
  5. Run Manage BitLocker and switch off BitLocker (needed so that the Linux installer can safely resize it).
  6. Run Disk management and make sure you understand what partitions exist and what they are all for.
  7. Use the BIOS to disable Secure Boot. You can switch it back on later and it’s just going to cause you a problem in the short term.

Partition preparation and OS installation

  1. Boot from Linux live USB (in my case Mint 19)
  2. Confirm that you have booted in UEFI mode (and not legacy mode). Open a terminal and run:

    It should return a list of bootable devices and the current boot order. If it returns an error about EFI variables not being supported, then you are booted in legacy mode and need to fix that first.

  3. Run gparted (you can’t do this using the partitioning tool built in to the installer, because the moment it has finished creating the partitions it will then try to start installing to them. You need to insert the encryption set up in between these steps, so we’ll do it before even running the installer).
  4. Delete recovery partitions you have decided you don’t want; you won’t need these if you made the recovery drive above. The partition that was called WINRETOOLS in Windows (about 1Gb) can go.
  5. Resize the main Windows partition as small as you dare to without making it unusable. These days I’d recommend at least 90Gb if it’s a secondary OS. Mine’s 55Gb after updates are all applied and before I’ve installed any apps or put any data on it. Yikes.
  6. In the free space you now have, create your desired Linux partitions as ext4. Make sure you set labels and partitions names. You WILL need a separate /boot partition, and GRUB has to be able to find the kernel image in an unencrypted form in order to then access then other encrypted partitions.Here’s my choice for a 512Gb drive:
    New size (Mb) Mount point File system type File system label
    800 /boot ext4 BOOT
    50000 / ext4 ROOT
    Rest /home ext4 HOME

    I separate root and home so that I can reduce the reserved space on /home to 0 whilst maintaining it at 5% on /; I can fill my home drive to the tippy-top without destabilising the system.

    50Gb might seem a lot for the root partition but Linux distributions are getting as big as Windows. I’ve been running a 25Gb root partition for the last few years and I’m getting bored with having to keep tidying it up so that I’ve got room to download updates.

  7. Open a terminal, and enter
    sudo bash

    to switch to a root prompt.

  8. Next enter
    fdisk -l

    list all your new partitions, and note the Device names for them.

  9. Now we’ll encrypt the non-boot partitions. You’ll need to invent some secure passphrases for them. For the root partition you’ll be entering this every time you turn the computer on, so make this secure but typeable. For the others they’ll just be emergency backups so you can make them a bit weirder if you like. To encrypt:
    cryptsetup luksFormat 

    once for each partition that is NOT /boot. So for me:

    cryptsetup luksFormat /dev/sda5
    cryptsetup luksFormat /dev/sda6

    You’ll get prompted for your chosen passphrase for each. Beware keyboard layouts; the live USB may have chosen a US keyboard layout, so if your chosen passphrase contains any characters that would be different on a US keyboard then you will not be setting the password to what you think you are. Remember that in future if something has gone wrong during boot and you are dropped to a root prompt or even being prompted by the kernel for the passphrase for the root paritition, you may not have the luxury of selecting they keyboard layout. So probably choose a passphrase with just letters and numbers. Or even just letters: making it longer is much better than using a bigger character set.

  10. Now we’ll unlock them so that the installer can see them and use them as partitions. To unlock:
    cryptsetup open  

    once for each partition that is NOT /boot. So for me:

    cryptsetup open /dev/sda5 cryptroot
    cryptsetup open /dev/sda6 crypthome

    This creates the two pseudo-partitions /dev/mapper/cryptroot and /dev/mapper/crypthome which the installer can treat as unencrypted partitions and write to normally.

  11. Now we’ll format them:
    mkfs.ext4 -L  /dev/mapper/

    once for each partition that is NOT /boot. So for me:

    mkfs.ext4 -L ROOT /dev/mapper/cryptroot
    mkfs.ext4 -L HOME /dev/mapper/crypthome
  12. All is now ready for OS installation. You’ll need at some point to override the installer’s partitioning scheme, choosing Custom or Something else or whatever option allows you to specify what partitions are used and where. Then set the unencrypted boot partition to be mounted at /boot, and the new /dev/mapper/cryptroot and other partitions to have their appropriate mount points. You don’t need to format them as they are new. Make sure the boot loader is configured to be installed on /dev/sda. Don’t select any options for encryption in the installer – you’ve already done it. Once installation is complete, don’t reboot. There’s more to do yet.

Post installation fiddling

From this point onwards I’m going to assume that you are capable of substituting your device names, map names, labels etc. if you have used different values to me, and I’ll just show you what I used.

  1. Now we’ll mount the newly-populated partitions to do some fiddling. Run
    swapoff -a
    umount /dev/mapper/cryptroot
    umount /dev/mapper/crypthome
    mkdir -p /mnt/root/boot/efi
    mount /dev/mapper/cryptroot /mnt/root
    mount /dev/mapper/crypthome /mnt/root/home
    mount /dev/sda4 /mnt/root/boot
    mount /dev/sda1 /mnt/root/boot/efi
    mount --bind /dev /mnt/root/dev
    mount --bind /proc /mnt/root/proc
    mount --bind /sys /mnt/root/sys

    /dev/sda4 is my boot partition, and /dev/sda1 is my EFI partition (created by Windows). Consult your fdisk -l output from earlier to see which ones yours are.

  2. Now we’ll grab the UUIDs of the encrypted partitions we made:
    lsblk --paths --output=NAME,UUID | grep -v mapper

    You’ll need the UUIDs of your root and home and any other partitions.

  3. Now we’ll tell the OS to unlock our encrypted drives while it is booting. Add lines like this to the new file /mnt/root/etc/crypttab:
    cryptroot UUID=756125d1-7845-ab56-cd56-780a-4a45cb56d4cb none luks,discard,noearly
    crypthome UUID=aa54bc47-2356-554d-d5c6-41ac-4a45cb5456a8 none luks,discard,noearly

    Note that these are the UUIDs of /dev/sda5 etc., not the UUIDs of /dev/mapper/cryptroot etc

  4. Improve the security on this file for when we later embed passphrases into it:
    chmod -rw /mnt/root/etc/crypttab
  5. Set these values in /mnt/root/etc/default/grub:

    Again this is the UUID of the underlying root device such as /dev/sda5.

  6. Now re-configure the Grub menu entries:
  7. That’s it. You can reboot. Your OS should now boot. You’ll get prompted twice to enter the passwords for your encrypted partition, once for your root partition and once for your home (and more for any others you made). In the next section we’ll eliminate some of those. For now, give yourself a pat on the back for getting this far.

Fewer passphrases

All well and good so far, but having to unlock each partition separately is a bit of a pain in the bum. Time to rectify that. Each partition can have up to eight passphrases associated with it, and those passphrases can be files as well as typed-in passphrases. So next we’ll let the root partition auto-mount the /home partition without us having to type in the passphrase.

  1. Open a terminal on your new installation. Type:
    sudo bash
    dd if=/dev/urandom of=/etc/crypt.home count=1 bs=512
    cryptsetup luksAddKey /dev/sda6 /etc/crypt.home

    This puts 512 bytes of randomness into the file /etc/crypt.home, and stores it as a second password for the /home partition.

  2. Next we open the file /etc/crypttab. Against the home partition where we had none (which causes it to prompt you for a passphrase), we will now specify a keyfile instead:
    crypthome UUID=aa54bc47-2356-554d-d5c6-41ac-4a45cb5456a8 /etc/crypt.home luks,discard,noearly
  3. Reboot. Now you should only be prompted for the password for your root partition, and home should auto-mount.

Should something ever go wrong, the password you originally set for the home partition is still valid, so you can use that as a recovery password for getting in to it. Store it safely.

No passphrases

By now you’re thinking “Why don’t I do this for the root partition too?”. You’d have to store it somewhere else that wasn’t the (not-yet-unlocked) root partition. That couldn’t be the /boot partition, as that isn’t encrypted (the way we’ve done it), so you’d be storing the keys to the kingdom in the clear for your laptop thief to recover. Instead, here’s a nicer way – store it on a USB drive. If the drive is plugged in, use it to open the root partition automatically. If it isn’t prompt for a password. If you leave this drive plugged in to a USB hub at home, then whenever you are at home it will be there and unlock automatically, but if you take the laptop elsewhere the drive won’t be attached and the passphrase will be requested. Automatic security the moment you leave the house!

  1. Get a sacrificable USB drive. You will erase all its content, and probably never use it for anything else again. I would recommend one with a clearly visible light, and without any fancy retraction mechanisms. You don’t want there to be iffiness about whether it’s plugged in or not. Smaller is better, it really only needs to be a few Mb in size.
  2. plug in the drive and open a terminal again:
    sudo bash

    Look at the end of the output from dmesg to see what device name your drive has been given. If you only have one internal drive and this is the only stick plugged in it will probably be sdb, but it’s best to check.

  3. Destroy the contents of the stick by filling it with random data:
    dd if=/dev/urandom of=/dev/sdb bs=1

    The bigger the stick the longer this will take.

  4. Extract a key from the randomness written to the drive and add it as a passphrase for the root partition:
    dd if=/dev/sdb of=/etc/crypt.root bs=1 count=512
    cryptsetup luksAddKey /dev/sda5 /etc/crypt.root
  5. Note down the path to the USB drive:
    ls /dev/disk/by-id

    If it’s not obvious which one it is, you can pull the stick out and ls again to see which entry has disappeared. Copy this into your clipboard.

  6. Create this file as _/usr/local/sbin/unlockusbkey.sh_:
    # flag tracking key-file availability
    # give the system time to settle and open the USB device
    sleep 2
    # check for the specific USB key
    if [ -b $USBKEY ]; then
    # if device exists then output the keyfile from the usb key
    dd if=$USBKEY bs=1 count=512 | cat
    if [ $OPENED -ne 0 ]; then
    echo "FAILED to get USB key file ..." >&2
    if [ -x /bin/plymouth ] && plymouth --ping; then
    plymouth ask-for-password --prompt "Enter passphrase"
    /lib/cryptsetup/askpass "Enter passphrase"
    echo "Success loading key file. Moving on." >&2
    sleep 1
    exit 0
  7. Modify the root partition entry of _/etc/crypttab_ to add the keyscript option on to the end:
    cryptroot UUID=756125d1-7845-ab56-cd56-780a-4a45cb56d4cb none luks,discard,noearly,keyscript=/usr/local/sbin/unlockusbkey.sh_
  8. Finally, rebuild initramfs:
    update-initramfs -u

All done. Now if you boot with the stick in the root partition should be unlocked automatically, and if you boot without you’ll be promptd for its password. Enjoy!

Puppet module test debug output — September 4, 2018

Puppet module test debug output

This one took hours to find out.

If you are using pdk to run your unit tests, all console output from your module gets squashed. Which is a bit rude, frankly. I could not find anyway of making it print stuff to the console so that I had half a hope of debugging my failing test.

Tha answer in the end was not to use

pdk test unit

But to run the tests with rspec directly. To do this (on Mint):

sudo apt-get install ruby-bundler
sudo bundle install

Then you can

bundle exec rake spec

from the directory which contains your spec folder. You will get different (more) output, and if you use Ruby’s puts you will be able to print to the console.

To keep track of when this gets fixed so that output is retained, follow this issue.

Template check plugin in Perl for Nagios — December 29, 2016
Land Rover Discovery 3 key case replacement — December 5, 2016

Land Rover Discovery 3 key case replacement

Bought a cheapie key case from eBay. Here’s how I replaced it.

  • Buy case and get the key part cut at a locksmith. You don’t need a specialist car locksmith.
    The new case with key part cut
    The new case with key part cut
  • Assembled and tested but the slightest touch of the key was activating the buttons, so the key was unlocking and locking like mad. Eventually I discovered the rubber studs in the key were activating the circuit board buttons. Glued a piece of card in to insulate it.
    Glued the button studs (super glue)
    Glued the button studs (super glue)
    Weighed down the cardboard with a penny
    Weighted down the cardboard with a penny
  • Still wasn’t working. Provided switch film didn’t have sufficient height to be work properly, so I used the old one.
    Original on right, useless replacement  on left
    Original on right, useless replacement on left
  • Re-assembled the correct way up 2015-05-29-13-55-00
  • Insert the transponder RFID blob in the corner 2015-05-29-13-55-24
  • Fit circuit board and battery2015-05-29-13-55-35
How to repair a brake pad wear sensor —

How to repair a brake pad wear sensor

I get pretty annoyed by repairable parts being binned. Brake pad wear sensors often get replaced when they could still work perfectly well, and at up to 50% of the price of the brake pads they’re really expensive to start with. So remove it and look at it, and work out how it works. In the case of this one off a Range Rover, for example:

A worn brake pad wear sensor with the wear link broken
A worn brake pad wear sensor with the wear link broken

It’s easy to see that one of the two wires coming into this sensor are really one loop, exposed at the “sensor” end. When this side of the sensor gets close enough to the brake disc, the metal is worn away, breaking the loop and preventing current from flowing. This is what the ECU senses as it will show a brake warning symbol on the dash. Clean it up and solder it together again:

The same wear sensor with a blob of solder reconnecting the two remaining stubs of metal.
The same wear sensor with a blob of solder reconnecting the two remaining stubs of metal.

Solder is very soft and will wear just as nicely as the metal that was there before, so the “sensor” will still work. Just refit.