Explog

Writing a type-checking calculator

To learn about typecheckers, I decided to make a small typed calculator. I figured this could be use…

Notes on CNNs

These are my notes about CNNs, some toy code in this colab. Motivation for CNNs While MLPs are a ver…

Attention - this value does not exist

Here, we play with the attention mechanism and word embeddings to get make a KV store that fuzzily s…

Python’s for loop syntax is more flexible than I thought!

[I came across an expression like: python for self.batch in batches: …

I had no idea one could…](2022-12-31-python-for.html)

Tihai in Indian music

The rhythmic aspect of Indian classical music uses cycles of a fixed number of beats. Familiar West…

Seeüberquerung 2022

I participated in the Seeüberquerung this year. About 6500 people swam from the Strandbad Mythenquai…

Quantum programming baby steps

After getting the basics of QC down with quantum.country, I find thinking about and surveying quantu…

Remapping delete to escape on Arch Linux

This will work for X based installations, and not just for the Del key. KDE/Gnome usually have tools…

The Bloch sphere

This video is the best derivation I found: https://www.youtube.com/watch?v=a-dIl1Y1aTs. BEGIN no…

What program does that dialog pop-up come from?

I got this pop-up recently and while it must be from some desktop application that uses Electron.js…

Two’s complement arithmetic is magic

Recently I revisited two’s complement arithmetic. It’s one of the coolest tricks I’ve seen. Computer…

I am very fortunate

The COVID-19 situation is the first such in my life. It has affected me and my family in various way…

Starting Tabla

When I moved to Zürich last year, I was drawn to percussion in general. I played around with a drum-…

My first Chaos Communication Congress, 36c3

The 36th Chaos Communication Congress took place in Leipzig from 26-30 December, 2019. I’d always wa…

Tagging functions with attributes in Perl

Suppose we have a Perl module that allows us to query a set of business objects (for example, purcha…

Embrace the borrow checker

The borrow checker is arguably one of the biggest sources of frustration when learning Rust. Once th…

Extended File Attributes on Linux

Files already have a lot of user accessible metadata associated with them – the last time of modifi…

Why I believe P ≠ NP

The HAMCYCLE problem If a graph \(G\left(V, E\right)\) contains a Hamiltonian cycle, we can pick a sub…

Creating lock-files in Unix

Lockfiles are commonly used for process level mutal exclusion. For example, a cronjob processing hou…

Summary of “ImageNet Classification with Deep Convolutional Neural Networks”

I decided to read interesting deep learning papers often and try to summarize them to aid my own und…

Spawn, log, reap children with IPC::Run

[In testing my implementation of a distributed failure detector, I needed to be able to:

Spawn n ins…](2018-01-16-ipc-run.html)

The bakery algorithm for mutual exclusion

The bakery algorithm was proposed by Leslie Lamport as a solution to Dijkstra’s concurrent programmi…

Optimal failure detector performance

This is a note to self on computing the lower bound on number of messages each process in a distribu…

Analysis of gossip based dissemination

Gossip based protocols are widely used in distributed systems for robust dissemination of informatio…

A simple backup setup using rsync

Suppose we have a bunch of files we’d like to have backed up on a remote host periodically. In this …

Cryptographic hash functions

Hashing is commonly used when we want to reduce a message of an arbitrary size to a fixed length “di…

Doing numbers without the numbers

Numbers are abstractions invented by humans to aid with various activities, mainly counting, and som…

SICP exercises 1.37-39

In these exercises, we deal with continued fractions. These are remarkable ways of writing rational …

Killing a process group with a timeout in bash

On Linux, most programs that daemonize write their process number to a file, which can be used to se…

Writing video captured using OpenCV to a file

This approach requires ffmpeg (forked to avconv on Debian), and is not really limited to OpenCV. If …

Baby steps with Elixir – Wordcount

Implementing (useful subsets of) basic Unix utilities is a great way to learn a programming language…

Deriving the laws of reflection and refraction of light from Fermat’s principle

Fermat’s principle of least time can be roughly stated as, “The path taken between two points by a r…

SICP Exercise 1.20 - GCD

Euclid’s algorithm for computing the GCD (Greatest Common Divisor) of two numbers is based on a very…

SICP excercises 1.17 and 1.18 - Multiplication using addition, doubling and halving

These two exercises ask us to implement a multiplication routine assuming we can only add, double, a…

SICP excercises 1.19 - Logarithmic time Fibonacci number generation

This exercise describes a transformation \(T_{pq}\), that, when applied to a pair $( a, b )…

SICP Exercise 1.15

Exercise 1.15 in SICP requires us to find the order of growth in time and space of a procedure that …

SICP Exercise 1.16

This exercise requires the design of a procedure that evolves an iterative exponentiation process us…

SICP Exercise 1.14

Given a set of coin denominations \(\mathbb{C}\) of size \(n\), in how many ways can an amount \(A\) be ch…

SICP Exercise 1.13

The Fibonacci sequence is given by, $$ Fib(n) = { \begin{cases} 0 & n = 0
1 & n = 1

Setting up OpenCV for Android without an IDE

Getting OpenCV running on Android without an IDE like Android Studion or Eclipse is actually very si…

Why IF has to be a special form in Lisp

In both Scheme and Common Lisp, the IF conditional is a special form with a simple evaluation rule: …

Exposing C++ OpenCV code to Python using Boost

Both C++ and Python are excellent languages that complement each other in many ways. I have been wor…

Reversing a list in functional style

Suppose we have a list implementation in which every element (or node) in the list contains a head, …

Variables in Common Lisp

Common Lisp is a dynamically, but strongly typed language. The variables carry the type information …

Common Lisp Collections

Even though Lisp lists are remarkably powerful and flexible, they are not the only data-structure av…

A Python stack for scientific computing

This post shows how to install the important packages for scientific computing in Python in a virtua…

The Tanimoto coefficient

There exist a number of metrics to measure similarity between two items, like the Euclidean distance…

Calculating C(n,r) efficiently

The number of ways of choosing \(r\) items from a collection of \(n\) identical items is referred to as …

Decorators with optional arguments in Python

Python decorators are one of the best features of the language, and I think that this SO answer des…

Configuring an HTTPS site with Django on Nginx + Gunicorn

I have deployed quite a few Django powered sites on PaaS like OpenShift, Google AppEngine. But I was…