All Posts
-
Context Is All You Need: How Self-Improving Agents Learn From Their Mistakes
Most AI agents are stateless. They solve problems, forget everything, and start fresh. Self-improving agents flip this model by accumulating context across sessions. This post explores context as the central abstraction that makes cross-session learning possible.
Read post -
Building a Knowledge Graph for My Blog
How I built an interactive knowledge graph connecting blog posts through semantic similarity and shared tags. A deep dive into embeddings, NER, and D3 force-directed layouts.
Read post -
OWASP Top 10 for LLMs Applied to Defence Use Cases
The OWASP Top 10 for LLMs focuses on commercial applications. This post maps each vulnerability to concrete military scenarios and shows how JSP 936 requirements address each risk.
Read post -
JSP 936 Compliance Checklist for AI Suppliers
A practical guide to the MOD's Dependable AI directive. This post distils the 32-page policy document into concrete requirements that suppliers must meet today, covering ethical principles, data standards, lifecycle documentation, and approval pathways.
Read post -
Teaching Claude to Edit Like The Economist
I built a Claude Code plugin that applies The Economist's editorial standards to writing. It detects weasel words, fixes passive voice, and maintains dialect consistency - and it works across all my projects.
Read post -
Decorating Christmas Trees with Group Theory
Applying Burnside's lemma and Polyna's enumeration theorem to quantify the number of patterns I can choose to arrange the baubles on my Christmas tree.
Read post -
Building a Semantic Blog Post Clustering System
I implemented an automated system to find related blog posts using embeddings and k-means clustering. The system runs at build time, using semantic similarity to group posts by topic and generate intelligent recommendations without any runtime overhead.
Read post -
Solving Terni Lapilli: A 2000-Year-Old Game
I investigate how it's possible to apply optimisation techniques and group theory to the ancient game of Terni Lapilli. Terni Lapilli is a version of tic-tac-toe, and like tic-tac-toe it's possible to model optimal decision making. I used this analysis to explore various areas of mathematics I hadn't encountered yet, like group theory.
Read post -
Evaluating Startup Ideas with Economic Theory
Using the Aghion-Howitt model from endogenous growth theory, this post presents an interactive calculator to evaluate startup viability. The calculator considers startup costs and market dynamics to compute expected value given competitive threats. Based on UK numbers but easily adapted for other regions.
Read post -
Understanding Ship Deceleration: Interactive Calculator and Mathematical Methods
How long does it take a ship to stop? I built an interactive calculator and worked through the hydrodynamics from first principles. Without friction brakes, we can see that hull form and propulsion type dominate stopping performance.
Read post -
From Naval Warfare to the Grimdark
I adapted a naval combat model to Warhammer 40k and built interactive calculators using iterative expected values, Markov chains, and Monte Carlo simulation. Monte Carlo wins for accuracy, but Markov chains reveal the probability distributions that expected values hide.
Read post -
Demonstrating handling Python errors with reproducible scripts
This article demonstrates how to enhance Python error handling using the traceback module while leveraging uv's support for PEP 723 to create reproducible scripts. It provides practical examples of how to move beyond basic ValueError implementations to include stack traces in error messages, making debugging and error handling more informative in production environments.
Read post -
Quickly checking Python dependencies
A short snippet for using
Read postuvto iterate on changing Python project dependencies. -
Adding goatcounter analytics to a Next.js website
How to add goatcounter analytics to a Next.js website.
Read post -
Debugging GKE GPU configuration
Troubleshooting GPU configuration on GKE can be painful. I explain how to troubleshoot GPU configuration issues in Google Kubernetes Engine (GKE) when running PyTorch workloads, emphasizing the importance of ensuring compatibility between Nvidia drivers, CUDA, and PyTorch. I outline a systematic approach to debug and verify that the GPU is recognized within the container and that PyTorch can access the GPU resources correctly.
Read post -
LLMs on the command line
I've integrated Large Language Models (LLMs) into my workflows to automate developer activities. This improves my understanding of their capabilities. I provide practical use cases, including code review, file summarization, web page content extraction, and even analyzing running processes, illustrating the diverse applications of LLMs in my daily tasks.
Read post -
Sailing navigation in the Solent
Useful resources for sailing, specifically in the Solent.
Read post -
Knowledge recall
I've implemented a process for recording the things I learn in the form of questions and answers, using the active recall technique. I document how I use the latex exam class to generate worksheets with and without the answers.
Read post -
Calling Tensorflow models in Scala
I demonstrate how to serve a TensorFlow model from Scala by serializing it to the ONNX format, allowing it to be utilized through the Java ONNX runtime. I provide a step-by-step guide on exporting a model and implementing the necessary logic in Scala to invoke it, highlighting key considerations and potential next steps for further development.
Read post -
How to use GitHub Actions to update a Jekyll blog
In this blog post, I explain how I implemented a GitHub Actions workflow to automate the updating of my Jekyll blog by building it and transferring files to my Droplet using
Read postrsync. I configured the workflow to trigger on pushes to thegh-actionsbranch and on pull requests to the main branch, ensuring efficient testing and deployment of changes. -
How to perform Metaprogramming in Scala
I explain how to perform metaprogramming in Scala using Scalameta to generate case classes based on a dataset schema defined in a CSV file. I detail the process of transforming schema information into an Abstract Syntax Tree (AST) to create valid Scala code automatically, illustrating the solution with various code snippets.
Read post -
How to write tests in Postgres
Writing simple tests in Postgres without requiring extra dependencies.
Read post -
Org-mode and Terraform
Using org mode to generate documentation and infrastructure.
Read post -
Org-mode and SQL
Literate programming with org-mode and sql.
Read post -
How to Safely Upsert DataFrames into Postgres
I share a Python script that safely upserts Pandas DataFrames into a Postgres database using psycopg2, highlighting the importance of handling potential SQL injection risks. I explain the process of constructing SQL statements to manage inserts and updates based on specified constraints, while utilizing the
Read postexecute_batchfunction for efficient batch processing. -
Classifying data with Python
Using scikit-learn and some Python features to set up a machine learning pipeline to quantify the efficiency of different classifers for classifying the movement of a stock price.
Read post -
Calculating covariance matrices with Python
I wanted to use lower level linear algebra constructs in Python to calculate a covariance matrix.
Read post -
How to reduce the memory used by Pandas DataFrames
A script illustrating how the memory usage of a pandas DataFrame can be reduced through altering data types.
Read post -
Useful Postgres techniques
Some notes on useful SQL commands and when they might be useful.
Read post -
When should you use the JSONB type in Postgres?
A review of different sources on when JSONB is suitable for use.
Read post -
Learning about data science
Useful resources for learning about data science.
Read post -
Reconstructing a point set from a Euclidean Distance Matrix
Recovering point locations from vectors.
Read post -
A review of Matrix Methods in Data Analysis
A review of the MIT 18.065 Spring 2018 opencourseware course, instructed by Gilbert Strang.
Read post -
How to practice for coding interviews
Some resources that I use to practice for passing coding interviews.
Read post -
Numerical Linear Algebra Cookbook
A review of numerical linear algebra for machine learning.
Read post -
Linear Algebra for Data Science Cookbook
A review of mathematical concepts helpful for data science.
Read post -
Uncertainty analysis literature review
A review of the literature on uncertainty and sensitivity analysis when applied to optimisation models.
Read post