Intro to RPi Pico with Mini Memory Game

I am the proud owner of a Raspberry Pi Pico which is a dinky microcontroller from the lovely people at Raspberry Pi. I also have the RGB Pico Keypad Base, because my husband was buying something else from Pimoroni (3D printer filament, more on that another day) and we love them and ... here we are :)

I've tried to write down and link to the stuff I found useful along the way with this project, in case it helps you too. Well, no, really so I can come back to it next time I'm using one of these!

Continue reading

Planets and Webhooks: a simple Flask app

As a Developer Advocate for an API company, I spend a lot of time talking about APIs and webhooks and HTTP in general. Recently I've been focussing on HTTP tools, but I really wanted a very simple example API that I could use that would return JSON but really let me focus on the tools, not the API. So I created a "Planets and Webhooks" API with a couple of GET endpoints to return JSON data, and another endpoint to receive and log incoming webhook data. Continue reading

The `python-is-python2` package on Ubuntu Focal Fossa

I did a fresh install of Ubuntu 20.04 Focal Fossa on my laptop, and was surprised at what happened when I went to install python:

$ sudo apt install python
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'python-is-python2' instead of 'python'

Um, what?

It turns out that since the python package has historically been Python 2, and there's a separate python3 package (and the commands match the package names, also pip3 etc), that default has remained in an attempt to break things for fewer people. Which is nice, but how do I get current, stable python?

sudo apt install python-is-python3

There's a sister package called python-is-python3 and installing that makes my python command use version 3 as I expected! It's a fairly good solution to the problem but it took me a moment to work out how to install it so I thought I'd write it down for next time! Hope it helps you too :)

Make Thumbnails of PDF Pages with ImageMagick

All my talk slides are PDF - I use rst2pdf to transform text-based ReStructuredText content into presentation slides. With all these PDFs hanging around, it can be very handy to have them as thumbnails. I use the images both in the printable speaker notes that I produce (and I should blog that too now I've mentioned it), and to share on twitter - especially the resources slide that everyone photographs! My image file is much more readable than your cameraphone picture in terrible lighting :) So here's my script for thumbnails in case you want to do the same; most presentation tools will export to PDF if you're not already working in that format. Continue reading

Grab Annotations from a PDF with pypdf2

If you've noticed a lot of PDF content around here lately, that's because I work with PDF a lot! Most of all, all my slide decks are in PDF and in the last year or so I've started using speaker notes in my presentations. Yes, this means that if you saw me speak in the first ten years of my speaking career, that was without speaker notes.

There are some situations where I don't have access to my speaker notes. Usually this is a good reason, such as I have mirrored my displays so I can demo or play a video without fiddling with my display settings in the middle of a talk. Sometimes, it's because something bad happened and I'm presenting from someone else's machine or a laptop that's completely off stage and I only have the comfort monitor. For those situations I use a printed set of backup speaker notes so I thought I'd share the script that creates these.

Continue reading

Pretty-Printing JSON with Python's JSON Tool

Today's quick tip is something that was widely retweeted after my "Debugging HTTP" talk at the ever-fabulous WhiskyWeb conference last weekend. When working with JSON on the commandline, here's a quick tip for showing the JSON in a nicer format:

curl | python -mjson.tool

You need python installed, but the JSON extension is probably included, and that's all you need for this tool. The result is something like:


You can also use this approach to present JSON data that has been captured to another file, for example, it's a handy trick that I use often when developing something with JSON as a data format.