mjt.me.uk
Hi, I'm Michael Tandy. I develop computer software for a living.
Recent Posts
Making the Macrosilicon MS2109 HDMI-to-USB capture device work on Linux
Posted on 26 Sep 2020
I brought a cheap (£10) HDMI-to-USB2 capture device based on the Macrosilicon 2109 - but I encountered a problem where it didn't appear at /dev/video* when plugged in, despite dmesg showing some recognition of the device. Fortunately, Nikola_F on the Arch Linux forums had already found the problem and offered a solution: The device is wrongly being treated as a USB audio device. You can confirm this by checking four new symlinks appear in ls...
Streaming live video over Wifi from the Panasonic Lumix GX80
Posted on 27 Apr 2020
Summary & Background The Panasonic Lumix GX80 is a mirrorless, interchangable lens micro four thirds camera. Some people have used it as a streaming webcam by connecting the camera's HDMI output to a HDMI-to-USB capture card (cost ~£120). It also has wifi connectivity, and can be controlled remotely - including a live preview over wifi. I set out to see I could use that wifi live preview like a webcam. In summary, I was able...
Blacklisting your USB Webcam's built-in microphone in Linux
Posted on 10 Apr 2020
Motivation I've got a headset with a microphone, and a webcam with a built-in microphone too; I always want to use the headset microphone, but sometimes the OS or videoconferencing tools start up using the wrong one. The good news is Linux will let you disable your webcam's microphone without disabling its video. I've done this successfully on Ubuntu 18.04 How it's done We're going to do it with udev-based USB device blacklisting First, we...
Loading Symantec VIP Access credentials onto Yubikeys
Posted on 29 Mar 2020
Summary You can generate Symantec VIP Access credentials and load them onto any Yubikey that supports TOTP or HOTP (i.e. any Yubikey that isn't blue). If you don't already have a Yubikey, you might also consider a Symantec VIP Hardware Authenticator which is less than half the price of the Yubikey I used - but I already have the Yubikey and the Hardware Authenticator doesn't ship to the UK TOTP vs HOTP The codes generated...
How cheap digital verniers work
Posted on 01 Apr 2017
Ever wondered how cheap digital verniers are able to produce good precision at very low prices? I did, so I took one apart. I'm not the first person to look at this - Grant Trebbin has some photos of a teardown, and has done a good job of finding patents like US5068653 Capacitive displacement measuring device with t-shaped scale coatings; Nick Müller has inspected one with an oscilliscope and Anyi Instrument Co have posted some...
ESP8266 SPI Flash protocol
Posted on 19 Sep 2016
I was wondering whether the ESP8266 SPI flash could be used for atomic (or sort-of-atomic) write operations - so I wanted to understand how the underlying SPI operations work. TLDR API call SPI command Note spi_flash_erase_sector 0x20 Repeated status reads (command 0x05) until erase completes spi_flash_read 0xBB Dual SPI spi_flash_write 0x02 Single status read, test completed immediately Read on to learn more... Some of the different SPI flash chips found on ESP8266 modules The ESP-12F...
Picoscope's 1,048,579 line CSV limit
Posted on 18 Sep 2016
If you've got here from Google, it's probably because you've exported a CSV or TXT file from picoscope and it's come out with 1048579 lines - maybe 3 of which are headers and 1048576 are data. You can find several posts on their forum about the same thing. Seems like Excel worksheets are limited to 1,048,576 rows by 16,384 columns, and Picoscope silently truncates CSVs to that length. I'm not sure why they decided to...
ESP8266 GPIO on deep sleep and reset
Posted on 09 Aug 2016
I want to do some battery powered sensing with an esp8266 - and to get a good battery life, I need to use the 'deep sleep' mode. Deep sleep requires a reset (including a bootloader and some radio calibration) to wake from. I decided to test how different pins behave when in deep sleep or undergoing a reset. Schematic By switching the Arduino Uno outputs between high, low and high impedance, we can test a...
Getting prism.js to work with Jekyll from a CDN
Posted on 16 Jul 2016
One option to syntax-highlight some code in a web page is prism.js. I use it in some posts on this blog. It's fairly simple to set up - but there's a trick to getting it to work from a CDN. When you download prism.js from the project website, a configuration tool lets you choose the languages you want included, then gives you a prism.js with only those languages included. Importing support for the language you...
Making an ubuntu box that's only on in business hours
Posted on 16 Jun 2016
So you've got an ubuntu box you want on during business hours, but you don't need it on outside business hours. Maybe it's a build server or something similar. Obviously, you could manually start it every morning - but you might be ill or go on holiday. Let's automate it with wake-on-RTC! The instructions below are for Ubuntu 14.04. First of all, create this file at /root/weekday-restart.sh (I use sudo pico /root/weekday-restart.sh but you can...
Certificate Transparency and the Certificate Authority Death Penalty
Posted on 23 Mar 2016
Certificate Transparency (CT) is a proposal that, when a certificate authority issues a certificate, they should log the details in a public, append-only log. This allows mis-issued certificates to be spotted by site owners - and hopefully revoked in short order. Browsers, when they know to expect a CT entry, can reject a certificate as fraudulent if the expected CT entry is missing. But CT will have two other interesting effects I haven't heard mentioned...
Some software design principles I've found useful, that you might find useful too
Posted on 22 Feb 2016
Here are some subjective opinions I've developed on software design - I'm "putting them out there" to see what other people think of them, and to explain to people who hear my opinions the thinking behind them. Even the greatest dependencies can go down. When you depend on another system, you should ask what you'll do if that system goes down. If anyone tells you "it will never go down", they probably don't know what...
The smallest 256x256 single-color PNG file, and where you've seen it
Posted on 24 Oct 2015
Do you recognise these images? There's a good chance you've seen some of them before now, probably several times. Here's a hint: They all depict the same thing. 103 bytes 156 bytes 178 bytes 379 bytes 921 bytes 1,189 bytes They all look pretty similar - so why the size difference? A quick intro to PNG The basic PNG file is comprised of recurring chunks. Each chunk is comprised of four parts: Length of the...
Contraction Hierarchies path finding algorithm, illustrated using three.js
Posted on 12 Jun 2015
Have you ever wondered how Google Maps can calculate driving directions so fast? Google can calculate driving directions in 100-500 milliseconds, whereas back in 1990s it took my father's 386sx about 30 minutes to calculate such a route. If you've done much programming, you probably already know the basics of this. Road maps can be represented, in the jargon, as "graphs", where junctions are "nodes" and roads between junctions are "edges" and the time taken...
Fake £2 coin
Posted on 19 Dec 2014
A few months ago I was handed some change which I didn't look at closely. Later, I realised I'd been given a fake £2 coin. I searched online and found lots of press coverage about fake £1 coins, but not much about the £2 coin. So here are some pictures! As you can see, the fake is a slightly different colour and the detail is a lot less clear: The fake coin bimetallic - the...
Kibana Log Searching 101
Posted on 23 Nov 2014
So someone has just given you access to Kibana and you're having trouble answering the kind of questions you could have answered easily with a sql- or grep-based system. Hopefully this cheat sheet will help get you started! How do I do a basic search? The 'query' box works a bit Google: unstructured text search, with some special commands, and if you get the command syntax wrong it just does an unstructured text search. Unlike...
Dirty Pcbs first trial board
Posted on 14 May 2014
After I saw Dirty PCBs on HN I decided to place a test order. I chose a 50mm x 50mm board and paid $12. I placed the order on the 13th April; the boards were reported as shipped on the 30th April, and they reached me (in the UK) the 14th May. Dirty boards tell me there was a hiccup at the board house, as they moved locations, so their normal turnaround time may be...
Amazon collection locker
Posted on 06 Apr 2014
I tried collecting some stuff from an Amazon locker, to see what the customer experience is like. The locker address is presented as a normal delivery address in your address book. When your item is available, you get an SMS: "Hello. Your parcel with (Item Name Which May Be Truncated) was delivered to Amazon Locker. Use pickup code: ABCD1A for this parcel" The message arrived quite quickly - I assume the locker triggers sending the...
Getting jd-gui to work on Ubuntu 13.10 x86_64
Posted on 22 Feb 2014
So you've just downloaded the latest version of jd-gui for linux but it doesn't start. TLDR: sudo apt-get install libgtk2.0-0:i386 libxxf86vm1:i386 libsm6:i386 lib32stdc++6 More details: Here's the process I went through: $ ./jd-gui ./jd-gui: error while loading shared libraries: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory $ sudo apt-get install libgtk2.0-0:i386 $ ./jd-gui ./jd-gui: error while loading shared libraries: libXxf86vm.so.1: cannot open shared object file: No such file or directory $...
Sending breaks to serial devices from the terminal, using termios
Posted on 04 Jan 2014
I'm playing around with an mbed LPC1768 for a project I'm working on. When you upload a new binary to the LPC1768 you have to perform a reset for it to run the updated binary; you can do this with a reset button on the board, or by triggering a soft reset by sending a break signal to a virtual serial port. To speed up my compile-upload-test cycle I wanted to be able to do...
Barcode reader test cases
Posted on 01 Dec 2013
I've had an interest in barcodes and image processing for some time, and as a side project some time ago I put together a software barcode reader. One of the things I did for that project was start collecting photos of barcodes that didn't scan well - either to use the images for my unit tests, or to order the products for physical tests. You can use these photos of degenerate barcodes to test your...
Falsehoods programmers believe about addresses
Posted on 29 May 2013
Perhaps you've read posts like Falsehoods Programmers Believe About Names and Falsehoods programmers believe about time. Maybe you've also read Falsehoods programmers believe about geography. Addressing is a fertile ground for incorrect assumptions, because everyone's used to dealing with addresses and 99% of the time they seem so simple. Below are some incorrect assumptions I've seen made, or made myself, or had reported to me. (If you want to look up an address for a...
Miscellaneous
Posted on 29 Dec 2012
Not so much a blog post as things I want to remember the URLs for! TLS (SSH) Server Name Indication patch for OpenJDK Webrev standards-compliant HTML patch Here's a robot: There should be a video here.