Tom Dickson's blogA blog about programming, mathematics, data science, and software engineering by Tom Dicksonhttps://tom-dickson.com/Decorating Christmas Trees with Group Theoryhttps://tom-dickson.com/blog/christmas-tree-bauble-group-theory/https://tom-dickson.com/blog/christmas-tree-bauble-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.Sat, 06 Dec 2025 00:00:00 GMTClassifying data with Pythonhttps://tom-dickson.com/blog/classifying-with-python/https://tom-dickson.com/blog/classifying-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.Tue, 03 Aug 2021 00:00:00 GMTContext Is All You Need: How Self-Improving Agents Learn From Their Mistakeshttps://tom-dickson.com/blog/context-self-improving-agents/https://tom-dickson.com/blog/context-self-improving-agents/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.Thu, 05 Feb 2026 00:00:00 GMTCalculating covariance matrices with Pythonhttps://tom-dickson.com/blog/covariance-python/https://tom-dickson.com/blog/covariance-python/I wanted to use lower level linear algebra constructs in Python to calculate a covariance matrix.Tue, 27 Jul 2021 00:00:00 GMTHow to perform Metaprogramming in Scalahttps://tom-dickson.com/blog/create-case-class/https://tom-dickson.com/blog/create-case-class/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.Sat, 30 Sep 2023 00:00:00 GMTFrom Naval Warfare to the Grimdarkhttps://tom-dickson.com/blog/from-naval-warfare-to-the-grimdark/https://tom-dickson.com/blog/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.Thu, 31 Jul 2025 00:00:00 GMTHow to use GitHub Actions to update a Jekyll bloghttps://tom-dickson.com/blog/gh-action-blog-update/https://tom-dickson.com/blog/gh-action-blog-update/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 `rsync`. I configured the workflow to trigger on pushes to the `gh-actions` branch and on pull requests to the main branch, ensuring efficient testing and deployment of changes.Sun, 08 Oct 2023 00:00:00 GMTDebugging GKE GPU configurationhttps://tom-dickson.com/blog/gke-gpu-drivers/https://tom-dickson.com/blog/gke-gpu-drivers/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.Mon, 19 Aug 2024 00:00:00 GMTJSP 936 Compliance Checklist for AI Suppliershttps://tom-dickson.com/blog/jsp936-compliance-checklist/https://tom-dickson.com/blog/jsp936-compliance-checklist/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.Sun, 04 Jan 2026 00:00:00 GMTBuilding a Knowledge Graph for My Bloghttps://tom-dickson.com/blog/knowledge-graph/https://tom-dickson.com/blog/knowledge-graph/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.Mon, 12 Jan 2026 00:00:00 GMTKnowledge recallhttps://tom-dickson.com/blog/knowledge/https://tom-dickson.com/blog/knowledge/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.Sun, 26 Nov 2023 00:00:00 GMTLearning about data sciencehttps://tom-dickson.com/blog/learning-data-science/https://tom-dickson.com/blog/learning-data-science/Useful resources for learning about data science.Sun, 07 Jun 2020 00:00:00 GMTHow to practice for coding interviewshttps://tom-dickson.com/blog/learning-to-code/https://tom-dickson.com/blog/learning-to-code/Some resources that I use to practice for passing coding interviews.Fri, 24 Apr 2020 00:00:00 GMTLinear Algebra for Data Science Cookbookhttps://tom-dickson.com/blog/linear-algebra-crib/https://tom-dickson.com/blog/linear-algebra-crib/A review of mathematical concepts helpful for data science.Fri, 10 Apr 2020 00:00:00 GMTOrg-mode and SQLhttps://tom-dickson.com/blog/literate-emacs-sql/https://tom-dickson.com/blog/literate-emacs-sql/Literate programming with org-mode and sql.Mon, 27 Dec 2021 00:00:00 GMTOrg-mode and Terraformhttps://tom-dickson.com/blog/literate-emacs-terraform/https://tom-dickson.com/blog/literate-emacs-terraform/Using org mode to generate documentation and infrastructure.Wed, 29 Dec 2021 00:00:00 GMTLLMs on the command linehttps://tom-dickson.com/blog/llm-on-cl/https://tom-dickson.com/blog/llm-on-cl/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.Sat, 10 Aug 2024 00:00:00 GMTA review of Matrix Methods in Data Analysishttps://tom-dickson.com/blog/matrix-methods-review/https://tom-dickson.com/blog/matrix-methods-review/A review of the MIT 18.065 Spring 2018 opencourseware course, instructed by Gilbert Strang.Tue, 05 May 2020 00:00:00 GMTAdding goatcounter analytics to a Next.js websitehttps://tom-dickson.com/blog/nextjs-goatcounter/https://tom-dickson.com/blog/nextjs-goatcounter/How to add goatcounter analytics to a Next.js website.Sat, 09 Nov 2024 00:00:00 GMTNumerical Linear Algebra Cookbookhttps://tom-dickson.com/blog/numerical-linear-algebra/https://tom-dickson.com/blog/numerical-linear-algebra/A review of numerical linear algebra for machine learning.Fri, 17 Apr 2020 00:00:00 GMTCalling Tensorflow models in Scalahttps://tom-dickson.com/blog/onnx-interface-scala/https://tom-dickson.com/blog/onnx-interface-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.Sun, 15 Oct 2023 00:00:00 GMTOWASP Top 10 for LLMs Applied to Defence Use Caseshttps://tom-dickson.com/blog/owasp-llm-defence-use-cases/https://tom-dickson.com/blog/owasp-llm-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.Thu, 08 Jan 2026 00:00:00 GMTHow to Safely Upsert DataFrames into Postgreshttps://tom-dickson.com/blog/postgres-dataframe-upsert/https://tom-dickson.com/blog/postgres-dataframe-upsert/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 `execute_batch` function for efficient batch processing.Mon, 09 Aug 2021 00:00:00 GMTWhen should you use the JSONB type in Postgres?https://tom-dickson.com/blog/postgres-jsonb-posts/https://tom-dickson.com/blog/postgres-jsonb-posts/A review of different sources on when JSONB is suitable for use.Sat, 10 Oct 2020 00:00:00 GMTReconstructing a point set from a Euclidean Distance Matrixhttps://tom-dickson.com/blog/reconstructing-point-sets/https://tom-dickson.com/blog/reconstructing-point-sets/Recovering point locations from vectors.Sun, 10 May 2020 00:00:00 GMTHow to reduce the memory used by Pandas DataFrameshttps://tom-dickson.com/blog/reduce_memory_usage/https://tom-dickson.com/blog/reduce_memory_usage/A script illustrating how the memory usage of a pandas DataFrame can be reduced through altering data types.Sat, 03 Jul 2021 00:00:00 GMTSailing navigation in the Solenthttps://tom-dickson.com/blog/sailing-navigation-solent/https://tom-dickson.com/blog/sailing-navigation-solent/Useful resources for sailing, specifically in the Solent.Fri, 26 Jul 2024 00:00:00 GMTBuilding a Semantic Blog Post Clustering Systemhttps://tom-dickson.com/blog/semantic-blog-clustering/https://tom-dickson.com/blog/semantic-blog-clustering/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.Sun, 30 Nov 2025 00:00:00 GMTUnderstanding Ship Deceleration: Interactive Calculator and Mathematical Methodshttps://tom-dickson.com/blog/ship-deceleration-calculation/https://tom-dickson.com/blog/ship-deceleration-calculation/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.Wed, 10 Sep 2025 00:00:00 GMTHow to write tests in Postgreshttps://tom-dickson.com/blog/simple-postgresql-testing/https://tom-dickson.com/blog/simple-postgresql-testing/Writing simple tests in Postgres without requiring extra dependencies.Sat, 15 Jan 2022 00:00:00 GMTUseful Postgres techniqueshttps://tom-dickson.com/blog/sql-overview/https://tom-dickson.com/blog/sql-overview/Some notes on useful SQL commands and when they might be useful.Fri, 26 Feb 2021 00:00:00 GMTEvaluating Startup Ideas with Economic Theoryhttps://tom-dickson.com/blog/startup-viability-calculator/https://tom-dickson.com/blog/startup-viability-calculator/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.Wed, 22 Oct 2025 00:00:00 GMTTeaching Claude to Edit Like The Economisthttps://tom-dickson.com/blog/teaching-claude-economist-style/https://tom-dickson.com/blog/teaching-claude-economist-style/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.Tue, 30 Dec 2025 00:00:00 GMTSolving Terni Lapilli: A 2000-Year-Old Gamehttps://tom-dickson.com/blog/trias-game-investigation/https://tom-dickson.com/blog/trias-game-investigation/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.Wed, 05 Nov 2025 00:00:00 GMTUncertainty analysis literature reviewhttps://tom-dickson.com/blog/uncertainty-sensitivity-analysis/https://tom-dickson.com/blog/uncertainty-sensitivity-analysis/A review of the literature on uncertainty and sensitivity analysis when applied to optimisation models.Wed, 26 Feb 2020 00:00:00 GMTDemonstrating handling Python errors with reproducible scriptshttps://tom-dickson.com/blog/uv-pep723-errors/https://tom-dickson.com/blog/uv-pep723-errors/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.Sun, 24 Nov 2024 00:00:00 GMTQuickly checking Python dependencieshttps://tom-dickson.com/blog/uv-python-dep-check/https://tom-dickson.com/blog/uv-python-dep-check/A short snippet for using `uv` to iterate on changing Python project dependencies.Sun, 17 Nov 2024 00:00:00 GMT