Skip to main content

Thinkserver: my web-based coding environment

I've made my own web-based coding environment for working on little projects.

A few years ago I found Glitch.

It's great: a web-based coding environment that makes it really easy to quickly start editing a web page. It has a live preview that helps to quickly see changes take effect.

But over time, as more and more of my stuff ended up living on Glitch, I was a bit uneasy about relying on someone else's service, and I also wanted to make some changes that would be idiosyncratic. In particular, I make a lot of things with Elm and while Glitch has some mechanisms for changing how a project is built, it's not documented well and my solution kept breaking. I also keep having trouble logging into Glitch, and the editor doesn't work particularly well on my phone.

So I decided to try making my own knock-off.

Read more…

How I worked out what character set web Excel uses for its CSV export

I'm collecting registrations for a work conference through Microsoft Forms, because that's the tool my employer gives me.

I want to get the data out of Excel as soon as possible, so I clicked the button to export it as a .CSV file.

I loaded that in Python, and got an error message:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe5 in position 4071: invalid continuation byte

Read more…

A script to convert a WCAG-EM report from JSON to reStructuredText for a VPAT

At work, I've had to produce VPAT documents for the software I'm responsible for.

The VPAT template asks you to list, for each of the WCAG criteria, whether you support it or not, or if it doesn't apply.

The W3C have made a WCAG-EM Report Tool which helps you to work through the WCAG criteria and make notes about whether they're satisfied.

At the end, you can download a copy of the report in either summarised HTML format, or a JSON file with all the data you entered.

The first time I did a VPAT, I mostly manually converted the information from the WCAG-EM report to a reStructuredText table, to go in our Sphinx documentation.

Now I'm doing it a second time, I know I don't want to waste my time doing that!

So I've written a Python script which takes in the JSON file from the report tool and prints out the tables for the VPAT template, in reStructuredText format.

Read more…

My development PC's homepage lists all the servers I'm running

A lot of what I do on a computer involves web development. For work, I develop several projects which involve running a Django server, which I have to run locally while I'm working on them. And for client-side stuff, I always run a simple HTTP server to serve static files, because browsers apply a lot of security restrictions to pages loaded through file://.

For years, I would type in things like http://localhost:8000 into my browser's address bar, like a chump. Then one day, a lightbulb turned on and I realised that since I already have an HTTP server running on port 80, I could make its homepage be a list of links to the ports I usually run servers on.

A little while later, another, brighter lightbulb turned on and I realised that the homepage could be a script which scans every port to automatically find every server I'm running.

A webpage with two columns. The first lists "moodle" and "wordpress" under the heading "On port 80". The other has the header "Other open ports" and there are two list items. The first reads, "Directory listing for /", with port: 1535, cwd: ~/websites/checkmyworking.com, pid: 63072. The second reads, "Numbas development server", port: 8000, cwd: ~/numbas/editor, pid: 45650.

Read more…

Finding all my recent git commits

At the moment I'm writing up one of my regular development update posts on the Numbas blog. I try to write one every couple of months. The posts act as a changelog for the various projects related to Numbas.

It's been just over seven months since the last one, because of everything, so this time there's a lot to talk about.

Read more…

Experiences writing an ActivityPub server in Python with Django

This post is about how I wrote an ActivityPub server using the Django Python framework, to provide a fediverse account on the same domain as a WordPress blog.

My motivation

On The Aperiodical, we do a monthly post collecting bits of maths news that we've seen. This is the compromise we came to as we realised that we're too old and busy to keep up with writing in-depth posts about individual things any more.

When we started doing this, I set up a /news slash command in our Slack channel which would take a URL and some explanatory text, and add it to the current draft post. Slack insists you give a username to the account that replies to this command, so we have our happy little Aperiodipal secretary.

Since we only publish the news posts once a month, we sometimes miss out on spreading the word about time-limited events, such as deadlines to register for conferences or mathematical holidays. And when there's Big Maths News such as a proof of an old conjecture, it'd be nice to put something out immediately rather than waiting until it's old news.

So I thought it would be a good idea to automatically toot on the fediverse each time one of us adds an item to the news post, as part of the /news Slack command.

Ideally, I'd like the fediverse account to belong to the aperiodical.com domain, instead of a Mastodon instance such as mathstodon.xyz.

That meant I'd have to serve the ActivityPub protocol on aperiodical.com. This is the kind of thing you do when really you're more curious about how the protocol works than making a pragmatic decision of the best course of action.

Read more…

Mastodon admin experiences

Mastodon has really taken off this month, as a result of Twitter collapsing.

The instance I run with Colin Wright, mathstodon.xyz, has grown from about a thousand active users to just over 5,000 as I write.

There are lots of people running small Mastodon instances who suddenly need to support lots more activity than they're used to. I've had to learn a lot about making a webserver run at scale, so I thought it would be worth writing down what I've learnt.

I didn't take proper notes while fixing things, so I've probably forgotten some important non-obvious stuff. Soz!

This is just the things that stuck in my mind recently.

Read more…