Skip to content

Instantly share code, notes, and snippets.

View alexwilson's full-sized avatar
🎧
i only speak techno.

Alex Wilson alexwilson

🎧
i only speak techno.
View GitHub Profile
@alexwilson
alexwilson / README.md
Created December 31, 2025 05:33
Pedometer++ Step Count Importer

Pedometer++ step count importer

Imports step counts from a CSV file and upserts them into a Pedometer++ .steps file.

This is for backfilling step data from external sources (Google Fit, Apple Watch exports, spreadsheets, etc).

How to use it?

Firstly, you need a .steps file. Pedometer++ will create this for you from an export.

@alexwilson
alexwilson / setup_displays.sh
Created October 27, 2025 06:11
DisplayPlacer script for quickly connecting to 1 external monitor
#!/bin/bash
# Always assume 2 displays: built-in (ID 1) and external (whatever isn't 1)
builtin_id="1"
all_ids=($(displayplacer list | grep "Contextual screen id:" | sed 's/.*Contextual screen id: //'))
external_id=""
for id in "${all_ids[@]}"; do
if [ "$id" != "1" ]; then
external_id="$id"
@alexwilson
alexwilson / fix-csv.py
Created June 24, 2025 07:16
Fix malformed CSVs
import csv
import sys
def escape_field(field):
if any(c in field for c in ['"', ',', '\n', '\r']):
field = field.replace('"', '""')
return f'"{field}"'
return field
def fix_row(fields, expected_columns):
@alexwilson
alexwilson / README.md
Last active December 2, 2025 07:57
Proxy PageRouter Pages

Generate PageRouter Page Proxies

This is a utility for generating proxies of NextJS Page Router pages, allowing you to separate pages from their routing. It was built for use in a migration from NextJS App Router to Page Router.

ts-node tools/generate-pagerouter-pages.ts <oldDir> <newDir> [--dry-run] [--overwrite]
const GOOGLE_DRIVE_FOLDER_ID = '';
const GOOGLE_DOC_TEMPLATE_ID = '';
const SLACK_WEBHOOK_URL = '';
function isMonday (d) {
return d.getDay() === 1
}
function nextMonday() {
@alexwilson
alexwilson / resume.json
Last active May 23, 2023 15:25
resume.json
{"basics":{"name":"Alex Wilson","label":"Financial Times","image":"https://avatars.githubusercontent.com/u/440052?v=4","email":"","phone":"","url":"https://alexwilson.tech/","summary":"","profiles":[{"network":"gitconnected","username":"alexwilson","url":"https://gitconnected.com/alexwilson"},{"network":"GitHub","username":"alexwilson","url":"https://github.com/alexwilson"}],"headline":"Principal Engineer at FT • Building digital products & the future of news","blog":null,"yearsOfExperience":null,"username":"alexwilson","locationAsString":"London","region":"London","karma":10,"id":"f31652cc-0a5a-488a-9040-ed96428fd68b","followers":94,"following":90,"picture":"https://avatars.githubusercontent.com/u/440052?v=4","website":"https://alexwilson.tech/"},"skills":[],"projects":[],"work":[{"name":"Financial Times","location":"London","description":"","position":"Principal Engineer, Customer Products","url":"https://ft.com","startDate":"2022-01-01","endDate":"","summary":"","highlights":[],"isCurrentRole":true,"start"
@alexwilson
alexwilson / main.php
Created November 26, 2022 20:40
Continuously retry something in PHP
<?php
set_error_handler(
function ($errno, $errstr, $errfile, $errline ) {
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
}
);
function executeCode(){
echo "Hello world!";
@alexwilson
alexwilson / google-reader-api.md
Last active March 7, 2022 00:59
Google Reader API

Google Reader API

Note : This document is totally unofficial. You should not rely on anything on this document is you need an exact information.
Google Reader API has not officially been released. This document has been made mainly by reverse-engineering the protocol.

Requirements

Google Reader API requires:

@alexwilson
alexwilson / index.js
Created April 1, 2021 11:05
Origami package.json managed build-service URLs.
const package = require('./package.json');
const origamiDependenciesFromPackageJson = Object.keys(package.dependencies)
// Find installed Origami modules.
.filter(key => key.startsWith('@financial-times/o-'))
// Reformat them
.map(key => ({
component: key.replace('@financial-times/', ''),
@alexwilson
alexwilson / EmptyTrashCommand.php
Created October 8, 2020 09:22
eZ - empty trash
<?php
declare(strict_types=1);
namespace AppBundle\Command;
use AppKernel;
use DateTime;
use Exception;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
/**