• Home
  • Posts
  • Bookshelf
  • Contact
  • Thumbnail image for post 84

    84. On zram swap and zswap

    2026-05-05
    1800 words
    • #infra

    I recently converted all my machines from zram swap to zswap. In this post I go over the differences between the two and why zswap is almost certainly better for any general use-case.

    ⤷ Read more
  • Thumbnail image for post 83

    83. What the hell is a decibel?

    2026-04-25
    1800 words
    • #audio

    Decibels come up often in digital audio and I’ve always found them to be confusing. In this post, I try to explain what decibels are and more importantly, how they’re used in practice.

    ⤷ Read more
  • Thumbnail image for post 82

    82. A load balancer on every host

    2026-04-21
    1650 words
    • #infra
    • #nixos

    I’ve started running HAProxy on every machine in my fleet. This neatly solves the problem of connecting to services in my Kubernetes cluster, as well as making it possible to have nice URLs for local services running on weird ports.

    ⤷ Read more
  • Thumbnail image for post 81

    81. Building the grandma videoconf

    2026-04-05
    2200 words
    • #infra
    • #nixos

    Grandma wants to talk to her grandkids and also see them. The problem is that grandma cannot interact with modern technology at all. No keyboard, no mouse, no touchscreen—the solution has to be fully automated. Let’s build this.

    ⤷ Read more
  • Thumbnail image for post 80

    80. Combining sine waves

    2026-02-18
    2300 words
    • #audio

    In the first post in this series, we generated sine waves. In this post, we combine sine waves together to explore harmonics, dissonance, and the 12 tone system used in Western music.

    ⤷ Read more
  • Thumbnail image for post 79

    79. Securing SSH keys with FIDO2

    2026-02-09
    1400 words
    • #infra

    Let’s make it impossible for someone to steal our SSH keys by storing them on a FIDO2 security token like a YubiKey. In 2026, this turns out to be easy to do and is a bit of convenience we can just buy off-the-shelf.

    ⤷ Read more
  • Thumbnail image for post 78

    78. Making sounds with WebAssembly

    2026-02-05
    2150 words
    • #audio
    • #rust
    • #webtech

    I find audio to be arcane and hard to think about. Let’s build an intuition together by writing increasingly complex programs that deal with sound. In this post, we go from what is sound to producing a sine wave with Rust, WebAssembly, and Web Audio.

    ⤷ Read more
  • Thumbnail image for post 77

    77. Adding big files to a static blog with Nix

    2026-01-20
    1150 words
    • #nixos
    • #webtech

    In this post, we figure out how to include big video and WASM files in a static site without adding them to the git repo. We do this with Nix because when you have a build-system shaped hammer, everything starts to look like a build-system nail.

    ⤷ Read more
  • Thumbnail image for post 76

    76. SWD debug probe with the Pimoroni Explorer

    2025-12-13
    450 words
    • #embedded

    The Pimoroni Explorer is a nifty little RP2350 board with a 320x240 pixel screen, a speaker, 6 buttons, a breadboard, and headers galore. One problem is that it doesn’t have an SWD debug header. Let’s fix that.

    ⤷ Read more
  • Thumbnail image for post 75

    75. A multi-type table in Rust

    2025-12-07
    1300 words
    • #rust

    Let’s write a type-safe table in Rust where the values can be of different types. This could be used as a cache sitting in front of a web server, as storage for entities in a game world, or as a config map.

    ⤷ Read more
  • Thumbnail image for post 74

    74. So many bots

    2025-11-12
    2850 words
    • #rust
    • #webtech

    All the online chatter about AI crawlers made me realize I have no concrete numbers, so I added more stats to this blog. Let’s look at the numbers together and marvel at all the bot activity.

    ⤷ Read more
  • Thumbnail image for post 73

    73. A blogroll

    2025-10-31
    2050 words
    • #rust
    • #webtech

    I added a blogroll to my front page. You can see it below. This post explains how I bolted it onto my mostly static site and why I decided to add it.

    ⤷ Read more
  • Thumbnail image for post 72

    72. Writing an FX rates viewer with Rust and Slint

    2025-10-10
    4750 words
    • #gui
    • #rust

    I wrote another FX rates viewer, this time using the Slint toolkit. At 1k LoC, it’s a bit too long to go through line by line, but there are still lessons to be learned and traps to be weary of. Let’s see what they are.

    ⤷ Read more
  • Thumbnail image for post 71

    71. Writing a metronome in Rust on a micro:bit

    2025-09-05
    2600 words
    • #embedded
    • #rust

    Let’s write a simple metronome using a micro:bit and see how easy embedded programming in Rust is in 2025.

    ⤷ Read more
  • 70. Easy file-sharing with WebDAV

    2023-09-16
    1050 words
    • #infra
    • #kubernetes

    A thing I’ve been missing is the ability to easily share files with insecure devices. I’ve tried a bunch of solutions over the years, including using Syncthing and Nextcloud, but they were neither nice to use nor run. Recently, a friend found a much better trade-off in terms of setup complexity and ease-of-use. So, let’s build such a file-sharing service with rclone, Nginx, and Kubernetes.

    ⤷ Read more
  • 69. Nicer RSS feed

    2022-12-19
    1850 words
    • #rust
    • #webtech

    I revamped this blog’s RSS feed. The downside is that RSS readers will probably show the last few posts again. Sorry about that. On the upside, the new feed contains full post contents and is standards compliant. This post lists the changes I made, mostly to the axum webserver setup.

    ⤷ Read more
  • 68. Building containers with Nix and Gitlab CI

    2022-12-14
    900 words
    • #gitlab
    • #nixos

    Let’s build a container around a Rust webserver and some static files using Nix and Gitlab CI. The process is what you’d expect, but there are a few details that are annoying to puzzle out.

    ⤷ Read more
  • 67. Designing an ergonomic currency type in Rust

    2022-12-05
    2350 words
    • #rust

    Let’s design a Currency type in Rust. We’ll iterate through several versions, starting with the ubiquitous str, and finishing with a stack-allocated type built with Rust’s new const generics.

    ⤷ Read more
  • 66. Writing a polling document generator in Rust

    2022-09-17
    1350 words
    • #rust
    • #webtech

    Let’s write an app that watches some files for changes, runs them through Liquid templates (rs), and then compiles the output with LaTeX. It’ll take about 200 lines of code. This scheme is very useful when you need to produce some kind of document from data available to a Rust program, and when you expect to be iterating on the templates a lot.

    ⤷ Read more
  • 65. Accents and diacritics with the compose key

    2022-08-20
    600 words
    • #ui

    The compose key on Linux lets you input characters with accents or diacritics without changing keyboard layouts. You type something like Compose’e and get é. It’s very useful if you use English almost exclusively, but occasionally need to write in a language with extra letters. Let’s see how to enable the compose key, how to check what key combos are available by default, and how to add our own.

    ⤷ Read more
  • 64. Accessing Kubernetes services through Wireguard

    2022-06-07
    2900 words
    • #infra
    • #kubernetes
    • #networking

    I figured out how to access Kubernetes services on my cluster without the need for kubectl port-forward or an ingress. It can all be done with Linux routing tables, and Wireguard makes this trivial to set up.

    ⤷ Read more
  • 63. A NixOS flake for Rust, egui, and OpenGL

    2022-05-21
    1200 words
    • #gui
    • #nixos
    • #rust

    I wrote a little OpenGL app in Rust and the hardest part was getting it to run on NixOS. This post describes the flake that works, and lists the errors that happen if the configuration isn’t right.

    ⤷ Read more
  • 62. Writing an FX viewer in 200 lines of Rust

    2022-05-15
    2000 words
    • #gui
    • #rust

    Let’s write a little exchange rate viewer in Rust. It will have a GUI, fetch rates from the Internet, support changing the currencies without having to recompile, and all this in about 200 lines of code.

    ⤷ Read more
  • 61. Good open-source Android apps

    2022-05-11
    2500 words
    • #android
    • #listicle

    I prefer using open-source apps on my Android phone, both as a matter of principle, but also because they tend to be less bloated and more focused. The big problem is finding good apps. In the hope that this helps others, here’s my list of good open-source Android apps.

    ⤷ Read more
  • 60. Serverless feedback form with proof-of-work

    2022-04-30
    2000 words
    • #crypto
    • #webtech

    I added a feedback form under every post on this blog. It’s a bit of client-side Javascript, a couple of serverless functions, and a proof-of-work scheme to deter spammers. Let’s see what it looks like.

    ⤷ Read more
  • 59. Writing a lazy Rust iterator over file blocks

    2022-04-04
    2050 words
    • #rust

    While writing the nix-nar crate, I had to bend Rust’s Iterator API to do things it wasn’t designed for. The resulting code looks strange, so let’s walk through increasingly complex implementations to see why it has to be that way.

    ⤷ Read more
  • 58. Writing a NixOS service module

    2022-03-16
    2250 words
    • #nixos

    Let’s write an nbd service module for NixOS. We’ll look at the shape of NixOS modules, define the service’s options, generate the configuration for the server, write tests, and see how upstreaming into nixpkgs works.

    ⤷ Read more
  • 57. Triggering Kubernetes rollouts from Gitlab CI

    2022-02-19
    1350 words
    • #gitlab
    • #infra
    • #kubernetes

    Let’s setup Gitlab CI to trigger a rolling restart of a Kubernetes deployment. This is a lightweight alternative to a something like Flux which requires an operator running in the cluster.

    ⤷ Read more
  • 56. Debugging a 12 minute hang after SFTP login

    2022-02-10
    1750 words
    • #debugging
    • #infra
    • #kubernetes

    This is the debugging story of a strange 12 minute hang I’d get after logging in to my SFTP server. It wasn’t the usual culprits, and it wasn’t any of the likely cloud complications. Instead it turned out to be an issue as old as POSIX itself.

    ⤷ Read more
  • 55. Generating secrets with nix flakes and cfssl

    2022-02-05
    1500 words
    • #infra
    • #nixos

    Many recent distributed programs like etcd or Kubernetes require TLS certificates to communicate securely. Creating these by hand is tedious, so let’s see how to automate it with a nix flake.

    ⤷ Read more
  • 54. NixOS 21.11 and nftables

    2022-01-01
    2500 words
    • #networking
    • #nixos

    NixOS 21.11 switched to the nf_tables backend for iptables. Let’s see what this means, and what new things we can and cannot do.

    ⤷ Read more
  • 53. Syncthing+Nginx setup on Kubernetes

    2021-12-23
    1150 words
    • #infra
    • #kubernetes

    Let’s deploy our own peer-to-peer Dropbox-like system with Syncthing, Nginx, and Kubernetes.

    ⤷ Read more
  • 52. Single directory Kubernetes manifests

    2021-12-18
    500 words
    • #kubernetes

    I am going to describe how I store all of my Kubernetes manifests in a single directory tree. The overriding goals of this setup is to commit all of the manifests to version control, and to apply them with a single command.

    ⤷ Read more
  • 51. Helm install and template

    2021-12-13
    500 words
    • #kubernetes

    Helm is an easy way of deploying to Kubernetes, but helm install is a bit annoying because it doesn’t save the changes it made to a local repo. That’s where helm template comes in.

    ⤷ Read more
  • 50. Umami setup on Kubernetes

    2021-12-03
    600 words
    • #infra
    • #kubernetes

    I recently setup Umami on this blog to get some basic analytics. The deployment on Kubernetes was easy, but it required some spelunking into documentation. Here are my notes.

    ⤷ Read more
  • 49. Kubernetes and Longhorn on ZFS

    2021-11-20
    550 words
    • #infra
    • #kubernetes

    I just switched some of my Kubernetes nodes to run on a root ZFS system. It was mostly painless, but there were a few places that required special configuration. Here are my notes.

    ⤷ Read more
  • 48. Fun with ureq, webpki, and IP addresses

    2021-07-27
    400 words
    • #rust

    If we try to open an HTTPS connection with ureq, and the host part of the URL is an IP address, then we get an InvalidDNSNameError. Let’s figure out what’s going on and how to work around it.

    ⤷ Read more
  • 47. Kubernetes networking

    2021-07-20
    2650 words
    • #kubernetes
    • #networking

    Kubernetes networking is complicated. It’s not complex, mind you, as there’s no emergent behaviour. It’s just complicated because there are lots of moving parts that are used in different circumstances. Let’s explore how the parts fit together by walking through several scenarios.

    ⤷ Read more
  • 46. Wireguard network mesh

    2021-01-09
    600 words
    • #infra
    • #networking

    Wireguard is a nifty little tool. The tagline describes it as an “extremely simple yet fast and modern VPN that utilizes state-of-the-art cryptography”. I have been using it for years to tunnel into my servers, as an Internet gateway, and as a jumpbox into the servers’ VLAN. Recently, I figured out how to configure it as a secure mesh between the servers.

    ⤷ Read more
  • 45. Superforecasting

    2020-12-30
    1050 words
    • #review

    I just finished reading Superforecasting: The Art and Science of Prediction by Philip E. Tetlock and Dan Gardner. It’s a pretty good book about the fallacies that make people, including experts, generally very bad at forecasting world events, and about the methods the authors used to generate vastly superior predictions from groups of volunteers.

    ⤷ Read more
  • 44. Secure Remote Disk

    2020-12-17
    350 words
    • #infra

    I needed a way to store my personal documents remotely in a secure way, so I came up with a scheme involving GCE, nbd, wireguard, and cryptsetup.

    ⤷ Read more
  • 43. Deep Work

    2018-11-05
    750 words

      I recently finished reading Deep Work by Cal Newport. It was an interesting, if personally depressing, read. My takeaways were a practical definition of deep work and an obvious-in-hindsight observations on what prevents deep work.

      ⤷ Read more
    • 42. challenge-prompt

      2018-10-26
      300 words
      • #rust

      It’s occasionally useful to introduce pause points into procedures. The idea is that, when a human operator is about to do something scary, we want them to stop and think for a second and not just do things by rote. Enter challenge-prompt, a small program and Rust library which challenges the user to type something.

      ⤷ Read more
    • 41. pingcat

      2015-02-02

      Most data on the Internet is transferred over TCP or UDP. The former works best when the transport needs to be reliable, and the latter is for when lower latency is more important than data loss or packet reordering. However, for a laugh, you can also transfer it over ICMP, aka ping.

      ⤷ Read More
    • 40. Variable Length Arrays

      2015-01-18

      When I learned C back in high-school, I was taught that all arrays declared on the stack had to have their size statically known at compile time. If we wanted variable sized arrays, we had to allocate them on the heap. It turns out that, as of C99, that’s no longer true.

      ⤷ Read More
    • 39. mkstemp

      2015-01-11

      Every time I’ve needed a temporary file, I’ve used mkstemp(3) or some variant of it. However, it wasn’t until recently that I wondered how it works, and more importantly, under what conditions it fails.

      ⤷ Read More
    • 38. Faster Fibonacci

      2015-01-07

      Most programmers are familiar with the naïve \(O(2^n)\) and the memoized \(O(n)\) algorithms for computing the nth Fibonacci number. However, with a bit of math, you can get the time down to \(O(\log_2n)\).

      ⤷ Read More
    • 37. An Optimisation Story

      2014-05-04

      Premature optimisation may be the root of all evil, but it’s also dammed fun. I recently needed an OCaml library for affine transformations: essentially, I needed to multiply 3x3 matrices together.

      ⤷ Read More
    • 36. Empirical Pi

      2014-02-22

      You’ve finally snuck into the evil mastermind’s billiards room. You’re only one door away from his office and the Big Red Button that stops the moon laser from vaporizing the Great Barrier Reef.

      ⤷ Read More
    • 35. OCaml's Compare

      2013-10-26

      Programming languages often have features which are not necessary but which are a boon to working with them. For example, Haskell compilers can automagically derive pretty-printers for user-defined datatypes which is a great help when debugging. Unfortunately, things don’t always go the way the language authors intended, and such features end up being more confusing than helpful. Take, for instance, the following implementation of a doubly-linked list in OCaml.

      ⤷ Read More
    • 34. Amortized Analysis

      2013-10-12

      The asymptotic complexity of a loop which does at most \(N\) constant-time operations is \(O(N)\). \(M\) such loops will then have \(O(M * N)\) time complexity. But not always. If you’re careful, you can sometimes do \(M\) loops of \(O(N)\) in only \(O(M)\) time.

      ⤷ Read More
    • 33. Cycling Arrays

      2013-10-05

      Here’s a challenge: cycle an array in-place. That is, given an array \([x_0, x_1, \dots, x_{n-1}]\) and a number \(m\), you must make \([x_m, x_{m+1}, \dots, x_{n-1}, x_0, x_1, \dots, x_{m-1}]\) using only a constant amount of additional memory.

      ⤷ Read More
    • 32. Faking Exceptions in C

      2013-10-02

      I love the breaking the structure of structured programs. We have previously implemented coroutines in C using setjmp(3) and longjmp(3). We are now going to fake exceptions in C using the same functions.

      ⤷ Read More
    • 31. IsString Abuse

      2013-06-25

      The IsString type-class and the OverloadedStrings extension were meant to save Haskell programmers from having to type {ByteString,Text}.pack over and over again, but they can be used in more creative ways as well.

      ⤷ Read More
    • 30. Fun with MI in C++

      2013-05-04

      The only features originally allowed into C++ were those which had efficient implementations. This sounds great, but the results were sometimes dubious. Consider the following program which uses multiple inheritance.

      ⤷ Read More
    • 29. Escape Analysis in Go

      2013-05-02

      Returning a pointer to a local variable is legal in Go. As a C programmer, the following looks like an error to me, but it’s perfectly alright in Go.

      ⤷ Read More
    • 28. A Stopping Problem

      2013-04-26

      Let’s play the following game: you roll a four-sided die; if 1 or 2 come up, you get 1$; if 3 comes up, you lose 1$; if 4 comes up, the game ends, and you lose all of your gains; finally, you can stop the game at any point and keep your gains. How do you play so that you maximize your gains?

      ⤷ Read More
    • 27. i^i is real

      2013-04-16

      A funny thing happens when you take the imaginary unit \(i\), and raise it to the power of \(i\); it becomes real. Again, \(i^i \in \mathbb{R}\).

      ⤷ Read More
    • 26. Quines

      2013-04-11

      A quine is something that, when evaluated, yields itself. More precisely, a quine is x, such that when we evaluate, interpret, or otherwise run x, we get x as the result. Quines are interesting because their existence in a language points to the language’s self-referentiality.

      ⤷ Read More
    • 25. Where's my Pi?

      2013-04-09

      When I powered on my new Raspberry Pi the other day, I realized I had a problem: even though we were both connected to the same WiFi network, I had no idea what its address was.

      ⤷ Read More
    • 24. Time Dilation

      2013-04-07

      A while ago, SMBC had a comic about whether our reality is simulated. They suggest that a way to tell would be to check if our reality were “optimised for computation”, such as if there were a minimum temperature, or a maximum speed. That got me thinking, are there other signs like that?

      ⤷ Read More
    • 23. Zingr

      2013-04-05

      Since Google has decided to shut down Google Reader, we should do what any self-respecting software developer would do: complain about it on Hacker News, and write a replacement that works for us. Today, we’ll be writing Zingr (“Zingr is not Google Reader”), a single-user web-based news aggregator in Python, SQLite3, Flask, Mootools, and Knockout.

      ⤷ Read More
    • 22. Human Evolution

      2013-03-31

      Consider a colony of bacteria living in a fresh water lake. Suppose the lake becomes more and more salty; the salt is damaging and ultimately lethal to the bacteria. What can they do? Ignoring more esoteric adaptations like bacterial conjugation, individually, they cannot do anything. As a species though, through selection of the fittest (most salt resistant, in this case), the bacteria evolve and adapt.

      ⤷ Read More
    • 21. Complexity Ordering

      2013-03-12

      We all know that \(O(N) < O(N^2)\), but what’s the relation between \(O(\sqrt{N})\) and \(O(\log_2(N))\)? Let’s determine an ordering for some common asymptotic complexities, and find the points where the smaller ones meet the larger ones.

      ⤷ Read More
    • 20. Fixed Frequency Loops

      2013-03-06

      Suppose we want to stress-test a server by hitting it with a fixed number of requests per second. Or maybe we want to write a game loop that runs at a fixed number of frames per second. In both cases, we want to run some code at a fixed frequency \(\nu\). More precisely, we want a loop that calls some function, sleeps for a bit, then restarts, and overall, the function is called \(\nu\) times per second.

      ⤷ Read More
    • 19. Bank Cards in the US

      2013-02-28

      As a European, I’ve had lots of problems using bank cards in the US. This wasn’t because of the bedlam that is the international banking system, but because of differences in user interfaces.

      ⤷ Read More
    • 18. Sized QuickChecks

      2013-02-27

      I recently ran into an issue with QuickCheck where one of my tests seemed to hang. My mistake was that I was ignoring how QuickCheck generates sized arbitrary values, and ended up creating very large structures.

      ⤷ Read More
    • 17. strace

      2012-12-25

      Although debugging with GDB is useful, it has the big disadvantage of focusing on the program’s internal state at a single moment in time. Often, we instead need to see how a program is interacting with its environment. In this post, we look at strace, a utility which traces system calls.

      ⤷ Read More
    • 16. Debugging Field Guide

      2012-12-20

      I’ve been programming for over a decade now, and, although I don’t usually use debugging tools, there are a few instances where I’ve found them to be indispensable. In this post, we go over a few debugging scenarios where print statements just don’t cut it.

      ⤷ Read More
    • 15. Phantom Types

      2012-12-17

      There are two ways of looking at the type-system of a language: as a set of rules which must be followed for the program to compile, and as a tool to make code more expressive. In this post, we talk about phantoms types, which is one way of doing the latter.

      ⤷ Read More
    • 14. Looper

      2012-12-12

      “A fixed point of a function is a point that is mapped to itself by the function”. In other words, it is \(x\), such that \(f(x) = x\). Fixed points are everywhere; in particular, the movie Looper is all about finding them.

      ⤷ Read More
    • 13. Solving Crises

      2012-11-29

      Last week, we saw how a financial crisis unfolds. In this post, we see what can be done to bring things back to normal again.

      ⤷ Read More
    • 12. Crises Stories

      2012-11-22

      Let’s talk about financial crises, what causes them, how they happen, and how to stop them. In this post, I tell a few made-up stories to illustrate how a crisis unfolds, and how it’s stopped; these stories are mostly modeled after the Panic of 1907; these stories are a gross simplification of what really happens and are only meant to give an intuition.

      ⤷ Read More
    • 11. On Small Samples

      2012-11-20

      The Law of Large Numbers says that “the average of the results of a large number of trials should be close to the expected value”. This is common knowledge, but most people are not familiar with the corollary that “the average of the results of a small number of trials may be quite far from the expected value”.

      ⤷ Read More
    • 10. Permissions Puzzle

      2012-11-14

      Here’s a Linux permissions puzzle for you: assume you have a file, on which the owner has no permissions, the group has read/write permissions, and everybody else has no permissions; you are the owner of the file, and a member of the file’s group; do you have permission to read or write to the file?

      ⤷ Read More
    • 9. On Transfer Speeds

      2012-11-12

      Let’s say we’re trying to copy a \(1\) GiB file from one machine to another over a gigabit ethernet LAN. How long will it take? (Spoiler: it’s quite a bit more than the simple calculation says.)

      ⤷ Read More
    • 8. Math Jokes

      2012-11-07

      I present here the longest and shortest math jokes I know. Furthermore, I will render the long one unfunny by explaining it.

      ⤷ Read More
    • 7. Java Variance Pitfalls

      2012-11-05

      Last week, I found out about a non-obvious pitfall of the Java language caused by the interaction of sub-classing and arrays. In short, Java arrays are covariant, so what I thought was illegal code compiles, and causes an exception at runtime. In this post, I give a quick intro to type variance, and describe the particular issue I encountered recently.

      ⤷ Read More
    • 6. Malloc Never Fails

      2012-11-02

      Here’s a fun bit of trivia: malloc on Linux never fails [due to the obvious cause]. In this post, we’ll show that this indeed is the case, and explore why this happens.

      ⤷ Read More
    • 4. permamake.sh

      2012-10-29

      I tend to build very often when working; in this post, I describe how I went from a build every few minutes to automatic builds on every file change.

      ⤷ Read More
    • 3. Loop Unrolling in sh

      2012-10-26

      Here’s a puzzle for you: what does the following shell script do? (works in zsh, bash, dash, BusyBox’s sh, but not tcsh; the script must have a trailing newline)

      ⤷ Read More
    • 2. Coroutines in C

      2012-10-24

      There’s a pair of C functions that I feel are underused, namely setjmp(3), and longjmp(3). With them, you can fake exceptions in C, implement coroutines, and much more.

      ⤷ Read More
    • 1. Random Integers

      2012-10-22

      Suppose you have a fair coin, that, when thrown, lands heads half the time and tails the other half. Design a procedure that makes a uniformly distributed random integer in the inclusive range [1, n].

      ⤷ Read More
    • 2008-02-15

      Langton's Ant

      Langton’s Ant is a turmite governed by simple rules whose outcome is both unpredictable and intresting. The path taken by the ant generates some surprising shapes, never appearing when you would expect them to, but a seemingly random moments. This article describes the rules behind Langton’s Ant, shows some of the images formed and provides a Python programme to simulate the ant.

      ⤷ Read More
    • 2008-01-17

      Finding All Paths of Minimum Length to a Node Using Dijkstra's Algorithm

      In this article I describe a way of modifying Dijkstra’s Alogrithm in order to find all the shortest path from a source to a node.

      ⤷ Read More
    • 2008-01-17

      Speeding Up Dijkstra's Algorithm 1

      In this article, I describe a simple (adds less than 1min of work) way to speed up Dijkstra’s Algorithm for finding the single source shortest path to every node in a graph.

      ⤷ Read More
    • 2007-12-11

      Gaussian Elimination

      In this article, I describe Gauss’ algorithm for solving n linear equations with n unknowns. I also give a sample implementation in C.

      ⤷ Read More
    • 2007-12-01

      One Source Shortest Path: Dijkstra's Algorithm

      In this article I describe Dijkstra’s algorithm for finding the shortest path from one source to all the other vertexes in a graph. Afterwards, I provide the source code in C of a simple implementation.

      ⤷ Read More
    • 2007-11-29

      One Source Shortest Path: The Bellman-Ford Algorithm

      In this article, I describe the Bellman-Ford algorithm for finding the one-source shortest paths in a graph, give an informal proof and provide the source code in C for a simple implementation.

      ⤷ Read More
    • 2007-11-20

      The 0-1 Knapsack Problem

      The 0-1 Knapsack Problem (AKA The Discrete Knapsack Problem) is a famous problem solvable by dynamic-programming. In this article, I describe the problem, the most common algorithm used to solve it and then provide a sample implementation in C.

      ⤷ Read More
    • 2007-11-20

      The Fractional Knapsack Problem

      In this article, I describe the greedy algorithm for solving the Fractional Knapsack Problem and give an implementation in C.

      ⤷ Read More
    • 2007-11-15

      All Sources Shortest Path: The Floyd-Warshall Algorithm

      In this article I describe the Floyd-Warshall algorithm for finding the shortest path between all nodes in a graph. I give an informal proof and provide an implementation in C.

      ⤷ Read More
    • 2007-11-09

      Minimal Spanning Trees: Prim's Algorithm

      In this article I give an informal definition of a graph and of the minimum spanning tree. Afterwards I describe Prim’s algorithm and then follow its execution on an example. Finally, the code in C is provided.

      ⤷ Read More
    • 2007-11-06

      Binary Numbers: Counting Bits

      In a previous article, I described the basics of binary arithmetic and gave a function to display the binary representation of a number. Here, we’ll look at several ways to count the set (1) bits in a number.

      ⤷ Read More
    • 2007-10-31

      Sudoku Solver

      Sudoku is that Japanese puzzle that requires you to fill in a grid of numbers. Here, I describe a general algorithm to solve these puzzles. Also provided is the source code in C++.

      ⤷ Read More
    • 2007-10-29

      Bit Operations

      In this article I’ll begin by defining binary numbers and describe the basic operations. Afterwords, I’ll show you several of the most common uses of binary numbers.

      ⤷ Read More
    • 2007-10-24

      Checker Challenge

      Checker Challenge is a very famous programming problem. It’s one of the first examples of backtracking anyone learns and variations of it frequently appare in contests.

      In this article, I’ll present the classic algorithm for solving it and then a few optimisations to make it run less like a geriatric turtle.

      ⤷ Read More
    • 2007-10-17

      Generating Combinations 1

      The combinations of n elements chosen as k is the number of unique ways of selecting k elements from a set of n.

      So, what are the ways of choosing 2 elements from a set of 4, {1, 2, 3, 4}?

      ⤷ Read More
    • 2007-10-15

      Generating the Partitions of a Set

      The partitions of a set S are all the ways in which you can choose disjoint, non-empty subsets of S that unioned result in S.

      So, what are the subsets of {1, 2, 3}?

      ⤷ Read More
    • 2007-10-10

      Generating Subsets

      There quite a few definitions of what a set is, but it all boils down to this…

      ⤷ Read More
    • 2007-10-08

      Generating Permutations 2

      Last time, we defined what permutation is and gave a few basic properties.

      In a few minutes we’ll see another algorithm for generating them, but first a little theory…

      ⤷ Read More
    • 2007-10-05

      Generating Permutations 1

      A permutation of n objects is an arrangement of n distinct objects…

      ⤷ Read More
    ▲
    • © 2026
      Alexandru Scvorțov (λyz.mailyscvalexznet)@.
      • CC BY-SA 4.0 |
      • All code EUPL-1.2-or-later
      • Home |
      • RSS Feed |
      • Fizz Buzz
      Theme: