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

Neopixel Shelf

In these days of video calling in place of any other social contact, I’ve seen a lot of excellent video backgrounds. Perhaps I’m old-fashioned but I went the traditional route, and set up my computer close to a wall (so you can’t see the mess in the room) and added a nice pinboard behind me. I looked a bit flat against the wall though, so I did what anyone else would do … and built a handmade wooden shelf with neopixels in it!

webcam's eye view, showing radiator, shelf with blue lights, and pinboard above
Continue reading

Add a Screenshot Button to Streamdeck with Golang

I’m the proud owner of a Streamdeck XL but as an Ubuntu user, the tool support isn’t great. There’s a Python library that gives a bit of a GUI but I found it hard to use and I’d have needed to put each piece of functionality as a commandline script that this program could call. Instead, I am using go-streamdeck to create a custom application – and I’m having fun! Today’s example adds a single button that runs a command to take a screenshot. Continue reading

Accessing Nested Config with Viper

I’m writing a Go application that glues together a bunch of other things, so it has a whole bunch of basically unrelated config, dumped in a yaml file. I was struggling a little with this non-standard use of Viper but actually, it does everything I needed. And, presumaby, more besides. I thought I would put some examples here to show how to handle this. Continue reading

Use a Local Version of a Library in Go

I have a couple of projects in Go where I need to work with a branch that isn’t the released version of a library that my code depends on. This happens when I’m the developer of the library and an application to use it, or when I’m a contributor to the library so I have my own fork and will want to check out branches to submit or test patches. Go has a pretty need way to allow this: using the replace keyword in the go.mod file. Continue reading

OBS Studio, Ubuntu 20.04 and a Wacom Tablet

When I upgraded my computers to Ubuntu 20.04, I noticed a weird problem with OBS when using an old Wacom Bamboo tablet (because, have you ever tried to use OBS without a pointing device?). I couldn’t actually click anything! The pointer seemed to be … pointing to the wrong place. After some research (and then some help with my research), I came across this post on OBS forums suggesting that this fixes it:

QT_XCB_TABLET_LEGACY_COORDINATES=1 obs

It does, and I never want to do the research for this again, so I’m posting it here and hoping I remember to look here when it happens!

Custom OpenAPI Style Rules with Spectral

Edit: There’s a newer post on this topic using Redocly CLI.

I work quite a bit with OpenAPI specs and with lots of specs and lots of collaborators, keeping the specs all functional (never mind tidy, consistent, or other dreamwords) is a challenge! We use spectral to check our specs, both when we work on them and in the build process. Spectral is great but it has Opinions(TM)!

For most users, running Spectral out of the box gives quite a lot of output even on an otherwise valid spec. I do think the default ruleset for Spectral is pretty good, but every situation is different so having your own ruleset to use is a good idea. This post shows how to use a ruleset and some examples. 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 :)

A First Netlify Function in Golang

I love all things serverless, and Netlify Functions is a neat and convenient way to access AWS Lambda. I do also love AWS Lambda but it’s so powerful and flexible that creating something like a webhook receiver can be hard going by the time you have all the permissions and API Gateway setup sorted out – for a simple webhook receiver, Netlify functions is a nice and easy way to get going. Best of all: it supports Golang but the docs are very JS-heavy so I am writing my notes here in case I need to refer back to them some day. Continue reading