This month, the premium bond interest rate changed quite substantially, from 4% in August to 4.65% in September. I was a bit surprised to only see a small increase in the median interest rate in my Premium Bond Calculator page. It turns out there is an error in the NS&I’s published information concerning the September draw, and led me down the following rabbit hole! Read more
This simple webapp is inspired by this Mathologer video. It generates diagrams by considering N evenly spaced points around a circle, and connecting point k to the point (k * M) mod N, where M is a multiplier. The diagrams are parameterised by (N, M). The (9, 2) and (7417, 240) diagrams feature in the video. Other really nice ones I've found are (8807, 839) and (2048, 820). Read more
The Raspberry Pi has a hardware watchdog timer on its board that is able to restart the board. This is a super useful feature if you want your Pi to restart in the case of a system failure like a kernel panic or a process consuming all resources. This page explains how to set this up manually on a Pi. Read more
Updated 6 July 2024 to due to updated odds and rate for March 2024 (4.4%) I've got some premium bonds, and wanted a better idea of the distribution of returns than the MSE Calculator provides. Unlike the MSE Calculator, I am quite likely not to update this as often as the rates change. It's based on the odds and rate given here and the estimated prize distribution here at the time I last updated it. See below for the details of the calculation. Read more
Oct 2017: I’ve removed comments! They stopped working because pooleapp is no more. Read more
When writing pyrrtm, I wrapped a large FORTRAN code using a cython interface. The original FORTRAN code was written as a standalone program, taking ASCII input files and producing ASCII output files, and so errors in the FORTRAN code were simply coded to print an error message and terminate the program. For example, using the following code to detect an error is common throughout the code base: Read more
The RRTM radiation code is used a lot in atmospheric science, and is pretty powerful. Unfortunately, it is stuck with a rather nasty ASCII interface (which I can't really imagine anyone using!) so when I came to use it to do some work, I wrote a python wrapper. Read more
I have recently added a new section to my website showing my favourite cycling routes. I used Viking to produce the GPX files (a truly excellent application!) and then wanted to navigate them using my phone. There isn’t a way of importing premade GPX routes into google maps, so we need to use another application, and one that has all the features we need (and many more we don’t need) is OsmAnd, which is a great offline map viewer powered by OpenStreetMap. Unfortunately it has a really bad user interface (to my mind its only flaw really) so actually setting up and using OsmAnd for GPX track navigation is difficult. The official how-to guide is here, and is fairly brief (there are other how-tos cover the installation). I summarise the process as follows for inclusion on each ride description: Read more
Since I made this site, I had been using a custom static generator that I wrote. I enjoyed the experience of making my own system from scratch (as always very rewarding!) but have now decided to go with a more standard system: Jekyll. The old system was too much work to maintain. Porting has been relatively easy as all the old content was already in Markdown.
When publishing a paper, it is often required to generate a single file for each image in the manuscript, which can be rather technically difficult when complicated figures are composed of separate plots or additional latex annotations have been added using overpic
or similar. An example of a particularly complicated figure from a recent paper is
Read more
I use ipython
and emacs
to do almost all of my data analysis work,
and I use them across many different machines and systems. Getting
ipython
to work nicely in emacs across multiple versions is a bit
challenging, especially in the older versions.
Read more
A while ago I switched to XeLatex from Latex as it can do some amazing
things. One particularly cool thing is word counting from within the
document itself. This is great for paper abstracts! I got the code
from
here
(or possibly somewhere else with similar code – it was a while ago!)
and tweaked it a bit to produce my wordcounter
environment:
Read more
I’ve written up documentation for the supercomputer at GFDL (Gaea), which I use for my simulations. I’ve put it up here for my reference and in case anyone finds it useful.
A long while ago, I wrote a script for
matplotlib that later (after lots of work by
Tony Yu and others) became the matplotlib
streamplot
function. This function generates plots that are constructed out of
streamlines of a flow, in such a way as to fill the domain uniformly
with such streamlines. I wrote the script to plot winds in the
tropical upper troposphere/lower stratosphere where there is a lot of
divergence and convergence (principally caused by convection over the
western Pacific and subsidence over the eastern Pacific.)
Read more
I like having custom keyboard shortcuts to launch applications (mainly
terminals, emacs, and Google Chrome.) For emacsclient
and the
gnome-terminal
, it makes sense to open a new window each time the
keyboard shortcut is keyed. However, I find it annoying when a new
Chrome window opens each time I key the shortcut. Often, I really
would rather switch to the existing Chrome window and open a new
tab. With multiple desktops (especially in Gnome 3) I find that I end
up with Chrome windows on all of my desktops – quite annoying!
Read more
Synctex is a feature available in the more recent LaTeX distributions that embeds links to locations in the source code (e.g. file name and line number) at the corresponding locations in a pdf file. When viewed with a compatible viewer and editor, we can automatically scroll the viewer to the point in the pdf corresponding to the location of the cursor in the editor, and vice versa. Very handy if you are editing a long document (e.g. a thesis or paper)! In theory, emacs and Okular is an example of a compatible editor and viewer combination. Read more
TeX-fold-mode
is a minor mode which is part of
AUCTEX, and automatically hides
a lot of the latex formatting commands. For example, \alpha
is
rendered using an alpha character, and references are shortened to
[r]
. Here’s an example:
Read more
Some commands are not highlighted well in AUCTEX; these commands are
commands which AUCTEX does not know about. To do highlighting
correctly, AUCTEX needs to know the number and type of arguments
(e.g. [...]
or {...}
) that a given command takes before it can
highlight the arguments correctly. There is a relatively simple way to
add your own commands with specified arguments, and this chunk of
.emacs code does the job:
Read more