2022

Running a GUI Application in a Docker Container

Containers are not usually associated with GUI applications, but there may be times when one might still want to run such a program inside a container, for example to isolate the application’s dependencies. Installing a GUI application in a container means that not only the application, but also all its specific dependencies are encapsulated inside the container (respectively, the container image), and can therefore reliably be removed from the system in a single step.

Using Xsession to Set an Environment Variable Without a Shell

The freedesktop project, arguably the most important Linux organization you’ve never heard of, has (among many other noble deeds) done an admirable job clearing up the mess of local cache and config files in one’s home directory. But how does one override their defaults, if this requires setting environment variables globally, for all processes, and outside an explicit shell environment?

The Heilmeier Catechism

George H. Heilmeier, director of DARPA (the advanced-technology research agency of the US Defense Department) from 1975 to 1977, formulated a set of questions to help evaluate research proposals.

A Strictly Geometrical Proof of the Altitude Theorem

The Altitude Theorem or Geometric Mean Theorem is a result from high-school geometry. In a right triangle, the altitude $h$ on the hypotenuse divides the hypotenuse into two segments, $p$ and $q$. The theorem now states that $h^2 = pq$ or, equivalently, $h = \sqrt{pq}$: the altitude equals the geometric mean of the segments of the hypotenuse.

The content of this theorem is a bit surprising, because the altitude and the hypotenuse segments seem geometrically somewhat “unrelated”: it’s not clear how one could (geometrically) be transformed into the other. And although the theorem can be proven in many different ways, many of the proofs are at least partially algebraic, and therefore do not provide an intuitive, geometric sense why it is true. But it turns out that a very elegant, strictly geometric proof of this proposition can be constructed.

The Diamond-Square Algorithm for Terrain Generation

The Diamond-Square Algorithm for Terrain Generation

The Diamond-Square Algorithm is the natural first stop for generating artificial landscapes. The algorithm itself is beautifully simple (more details below, and on its Wikipedia page). But a casual implementation ended up not working at all, prompting me to look for an existing implementation to learn from. However, most implementations I found looked hideously complicated (or just hideous), not necessarily correct, and/or used out-of-date programming languages and styles. It therefore seemed like a good idea to create a clean, simple “reference” implementation of this algorithm, using a contemporary and widely known programming language and style.