Demonstrating handling Python errors better 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.

Quickly checking Python dependencies

A short snippet for using `uv` to iterate on changing Python project dependencies.

Adding goatcounter analytics to a Next.js website

How to add goatcounter analytics to a Next.js website.

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.

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.

Sailing navigation in the Solent

Useful resources for sailing, specifically in the Solent.

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.

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.

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 `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.

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.

My personal blog deployment

I describe the process and rationale behind deploying my personal Jekyll blog using Terraform and Ansible, emphasizing the importance of simplicity and minimizing dependencies on external services. I also outline the architecture of my blog, the tools I used, and my future plans for automation and expansion of the deployment process.

How to write tests in Postgres

Writing simple tests in Postgres without requiring extra dependencies.

Org-mode and Terraform

Using org mode to generate documentation and infrastructure.

Org-mode and SQL

Literate programming with org-mode and sql.

How to Upsert DataFrames into Postgres safely.

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.

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.

Calculating covariance matrices with Python

I wanted to use lower level linear algebra constructs in Python to calculate a covariance matrix.

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.

Best Python packages for MVP development

Some useful Python packages and how they fit into my work.

Useful Postgres techniques

Some notes on useful SQL commands and when they might be useful.

When should you use the JSONB type in Postgres?

A review of different sources on when JSONB is suitable for use.

Learning about data science

Useful resources for learning about data science.

Reconstructing a point set from a Euclidean Distance Matrix

Recovering point locations from vectors.

A review of Matrix Methods in Data Analysis

A review of the MIT 18.065 Spring 2018 opencourseware course, instructed by Gilbert Strang.

How to practice for coding interviews

Some resources that I use to practice for passing coding interviews.

Numerical Linear Algebra Cookbook

A review of numerical linear algebra for machine learning.

Linear Algebra for Data Science Cookbook

A review of mathematical concepts helpful for data science.

Uncertainty analysis literature review

A review of the literature on uncertainty and sensitivity analysis when applied to optimisation models.