Mapping caps lock to escape in Windows 7

While working in a large organisation where all external software was forbidden, I wanted to map my caps lock to escape to improve my Vim experience. The route which finally worked was to use the reg instruction:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,3a,00,46,00,01,00,3a,00,00,00,00,00

I found this on vim.fandom.com. I first tried the "current user" method. This didn't work so I changed to using the "all users" option which was successful.

Setup Raspberry PI 3 with no (ethernet) cable, monitor, keyboard, etc.

A complete guide to setting up a Raspberry Pi 3 (RPi) to connect wirelessly. Everything is setup from your laptop, writing to a micro SD card before plugging the card in to the RPi. I'm doing this on an Ubuntu computer. I imagine it is very similar from a Mac.

  1. Download and unzip the Raspbian Lite operating system (OS). You will now have an img file ready to write somewhere.
  2. Download, install and run Etcher to write the raw operating system to the SD card. This is by far the easiest / safest way to write the OS to the card. (Note I have no liability for mistakes that may occur with this. Follow the instructions on Etcher's website)
  3. Open a command window and enter:

    where xyz is the path to the SD card and main_drive_abc will be some long text. One of these two is not necessary but I don't care which. This writes an empty file to these folders. They enable ssh so the RPi can be connected to using the SSH protocol from your laptop.
  4. Now to use WiFi you'll need to give the RPi your username and password. This command will open an editor on the file that stores this information:

    At the bottom of the file add this:

    Now press Ctrl+X to exit. Press "y" to save it as the correct filename.
  5. Put the SD card in the RPi. Plug in the USB power cable. You are ready to connect from your laptop.
  6. Find the RPi on your network using the command
    sudo arp-scan --localnet
    Hopefully there will be an obvious choice. If not, try the following instruction changing the final number in the IP address below with each choice you see in arp-scan's output
  7. Connect to the RPi with the command (changing 192.168.0.18 for whatever number your RPi is allocated on your network)

    The username you are using is pi. The password when prompted is "raspberry"
  8. It is a huge security whole leaving the password unchanged. Run

    This gives you an interactive menu. Change the password, update the system. You now have an operational Raspberry Pi to hack.

Swimming times

Options for lunchtime lane swimming near Canary Wharf (and NW London in the evening)

Tiller Road Burdett Road St Georges Swiss Cottage Northolt
Mon 12:15 - 13:30 12:15 - 21:30 12:30 - 13:30 06:30 - 21:30
Tues 12:15 - 13:30 12:00 - 21:30 12:30 - 13:30 2 lanes 06:30 - 21:30
Wed 12:00 - 13:30 12:00 - 21:30 12:30 - 13:30 06:30 - 21:30
Thurs 12:15 - 13:30 12:00 - 19:00 None 06:30 - 21:30
Fri 12:15 - 13:30 06:30 - 22:00 12:30 - 13:30 06:30 - 18:00 06:30 - 21:30

Pool hours rather than centre hours

RPi Tube status checker

Like most Londoners I depend on the Underground system to get to the office where I am on a contract. A delay or suspension can cause big problems for the morning commute so I decided to put my Raspberry Pi to use, alerting of problems on the tube network before heading out the door. I used TFL's API: status to check how the lines are running and put the Piglow I had to use – one arm for the Metropolitan line, one for the Jubilee line, the final arm for the other lines combined (I get to work using just the Met and Jubilee lines). A single light on an arm of the Piglow indicates good service, two lights - minor delays and the whole arm lit to indicate more serious problems.

Raspberry Pi showing tube status
Raspberry Pi showing London underground status

defaultdict explained

If we wanted to count occurrences in a list (without collections.Counter) we could write this:

Alternatively, we could use a defaultdict. The constructor of a defaultdict takes one arg – a function – what to do when a new key is added to the dict. So instead, you could write:

But the final addition that makes it briefer but perhaps more confusing on first approach is that defaultdict understands int to mean the same as lambda: 0 and has the same effect. I.e.

Free Windows images!

I had no idea this existed until I took an assignment on Coursera. The work required a Windows-only application but suggested using the free Windows images legally distributed by MS themselves. The image works for three months without limitations but even after you could just remake the image from the zip files rather than put up with the hour time limit imposed on the image's uptime.

Follow the link here and download the version you want

Car hire in Gran Canaria

Normally I tend to write about programming topics but since I was asked to leave a review for Dollar / Thrifty car hire in Gran Canaria I thought I'd write it publicly rather than just send it to them. This review was written on 2019-01-18 despite how the post's tagging reads...

The car we were assigned was significantly smaller in boot capacity than the one advertised. The advertised model was a Vauxhall Zafira (645 litres) and we received a Ford C Max (432 litres, from first Google links).

We needed a car seat for our toddler (about 16kg). The one we found in the parking bay way left in a puddle so the lower fabric was wet with the grime of the car park. The fabric generally looked worn from many years of use and adjusted poorly. I asked to change the seat. The surly woman seemed put out by being asked to change it, actually rolling her eyes at the request. All of the other seats in her store room seem in equal or worse state so we had to opt for the initial seat. The seat's straps were not of equal length on my son's shoulders so it felt unsafe but it was late and we had no choice but to leave with this seat in use.

On return to the airport I saw (local brand) Cicar's seats set out ready for their customers. They seemed pristine and even had the company's logo smartly stitched to the side of the seat with the manufacturer's logo. Next time I will hire with them.

Walks in Ashdown Forest

We recently took a break to Sussex and went one day to do the Winnie the Pooh Walk From Gills Lap. The map on the PDF showing the route to the starting car park was tricky to divy-up with a larger map. This is the grid location for the car park where the route begins:

Google maps Gills Lap link (51.064353, 0.092989)

We also struggled for some time to find the bridge where Pooh Sticks were first played. Follow directions to this car park:

Google maps "Pooh" car park link (51.078726, 0.099677)

Follow the downhill path to the bridge. Note you first pass a smaller bridge and then come to the proper one after another 3-4 minutes of walking from the first. Walk 25m further from the Bridge and you find a tree stump with a door in the side.