Liberate your daily statistics from JetPack


Bar chart showing how many times a blog has been red over a year.

Because Ma.tt continues to burn all of the goodwill built up by WordPress, and JetPack have decided to charge a ridiculous sum for their statistics, I've decided to move to a new stats provider. But I don't want to lose all the statistics I've built up over the years. How do I download a day-by-day export of my JetPack stats? Luckily, there is an API for downloading all your JetPack stats! First, get your API key by visiting https://apikey.wordpress.com/ - it should be a 12 character…

Continue reading →

Is "Dollar Cost Averaging" a Bad Idea?


A tiny lego Storm Trooper eats a chocolate coin.

It's sometimes useful to run experiments yourself, isn't it? New investors are often told that, when investing for the long term rather than chasing individual stocks, it is better to be invested for the longest possible time rather than trying to do "dollar cost averaging". DCA is the process of spreading out over time the purchasing of your investments. That way, you don't lose it all if the market drops the day after you invest. Let me explain... Imagine that it is 1994 and your rich…

Continue reading →

Drawing PPM images on the Tildagon in MicroPython


Various circuit boards showing images.

The Tildagon has 2MB of RAM. That's not enough to do... well, most things you'd want to do with a computer! There's not much processing power, so running complex image decoding algorithms might be a bit beyond it. Is there a simple image format which can be parsed and displayed? Yes! The ancient Portable PixMap (PPM) format. The standard is beautiful in its simplicity. Here's the header: P6 # Created by GIMP version 2.10.38 PNM plug-in 120 120 255 ���t�{... The P6 identifies it as a PPM…

Continue reading →

Setting the time on the Tildagon


Hexagonal circuit board with circular screen. It is showing the date and time.

I'm beginning my adventures in MicroPython in the hope that I'll have something interesting working on the Tildagon Badge for EMF2026. Here's a basic implementation of a clockface. Here's how to set the time on the badge. There's a hardware clock which should keep time between reboots. Install mpremote on your computer. Connect the Tildagon to your computer using a USB-C data cable On your computer's command line, run mpremote. You should see: > Connected to MicroPython at /dev/ttyACM0 >…

Continue reading →

Displaying a QR code in MicroPython on the Tildagon Badge


A hexagonal circuit board with a circular screen. The screen displays a monochrome QR code.

This was a bit of a labour of love - and something I wanted to get running during EMF Camp. I'm documenting in the hope it'll be useful for EMF 2026! Here's the end result: Background I'm going to assume that you have updated your badge to the latest firmware version. You will also need to install mpremote on your development machine. You should also have successfully run the basic Hello, World! app. Drawing surface The Tildagon screen is 240x240 pixels. However, it is also a circle. …

Continue reading →

Untappd to Mastodon - Updated!


A bottle of beer outside on a sunny day.

A few years ago, I wrote some code to post Untappd check-ins to Mastodon. I've recently updated it to also post a photo of the beer you're enjoying. First up, you'll need a file called config.py to hold all your API keys: instance = "https://mastodon.social" access_token = "…" write_access_token = "…" untappd_client_id = "…" untappd_client_secret = "…" Then a file called untappd2mastodon.py to do the job of grabbing your …

Continue reading →

There should only ever be one way to express yourself


Logo of the Python programming language.

I've been thinking about programming languages and their design. In her book about the divergence of the English and American languages, Lynne Murphy asks this question: wouldn’t it be great if language were logical and maximally efficient? If sentences had only as many syllables as strictly needed? If each word had a single, unique meaning? If there were no homophones, so we’d not be able to mix up dear and deer or two and too? That got me thinking about the creativity which can be exp…

Continue reading →

Compressing Text into Images


Random grey noise.

(This is, I think, a silly idea. But sometimes the silliest things lead to unexpected results.) The text of Shakespeare's Romeo and Juliet is about 146,000 characters long. Thanks to the English language, each character can be represented by a single byte. So a plain Unicode text file of the play is about 142KB. In Adventures With Compression, JamesG discusses a competition to compress text and poses an interesting thought: Encoding the text as an image and compressing the image. I would …

Continue reading →

Converting MoneyDashboard's export file to a CSV - for Firefly III and others


Logo of the Python programming language.

As I mentioned last week, MoneyDashboard is shutting down. They are good enough to provide a JSON export of all your previous transactions. It is full of entries like this: { "Account": "My Mastercard", "Date": "2020-02-24T00:00:00Z", "CurrentDescription": null, "OriginalDescription": "SUMUP *Pizza palace, London, W1", "Amount": -12.34, "L1Tag": "Eating Out", "L2Tag": "Pizza", "L3Tag": "" }, { "Account": "American Express", "Date":…

Continue reading →

How far did my post go on the Fediverse?


Cartoon of a tusked mastodon holding a phone.

I wrote a moderately popular post on Mastodon. Lots of people shared it. Is it possible to find out how many different ActivityPub servers it went to? Yes! As we all know, the Fediverse is one big chain mail. I don't mean that in a derogatory way. When I write a post, it appears on my server (called an "instance" in Mastodon-speak). Everyone on my instance can see my post. My instance looks at all my followers - some of whom are on completely different instances - and sends my post to…

Continue reading →

Using Selenium & Chrome to automatically download Blob files


Logo of the Python programming language.

The Selenium WebDriver is a brilliant way to programmatically interact with websites. You can write little Python scripts which can click around inside browser windows and do "stuff". I use it to download a file generated by a Javascript Blob and automatically save it to disk. Here's how. Set up the WebDriver After you've installed Selenium and the Chrome WebDriver, this is the standard boilerplate to use it in Python: from selenium import webdriver from selenium.webdriver.chrome.options…

Continue reading →

Importing IntenseDebate Comment XML into Commentics


The Logo for WordPress.

This is ridiculously niche. If this is of help to anyone other than to me... please shout! The IntenseDebate comment system is slowly dying. It hasn't received any updates from Automattic for years. Recently it stopped being able to let users submit new comments. So I've switched to Commentics which is a self-hosted PHP / MySQL comment system. It's lightweight, pretty good at respecting users' privacy, and very customisable. But it doesn't let you easily import comments. Here's how I fixed…

Continue reading →