• Running MongoDB from Guix

    I have been watching a tutorial on GraphQL recently (YouTube link) where the lecturer uses MongoDB for persistent storage. He instructs viewers to sign up for a service that hosts a database, but I wanted to run a local instance on my machine instead. MongoDB is not available in the Void repos, but fortunately it is available in the Guix repos. However, running the Mongo deamon requires a little tweak first.

    Continue reading…

  • Dotfiles were a mistake

    Unix has a clever trick for hiding a file from being displayed by the ls command or other file browsers: just prefix the file name with a period character. Many applications use this fact in order to place hidden files or directories in the user's home directory, usually containing settings, cached files, persistent data and whatever else developers might come up with. This practice has always struck me as just plain wrong, and I am glad that my sentiment was confirmed by Rob Pike years ago.

    Continue reading…

  • The best language to learn programming

    What is the best first language when learning how to program? There have been many opinions over the years, each with their own selling point: BASIC was created for beginners, Python is executable pseudocode, JavaScript runs everywhere on the web, and so on. However, I would argue that the truly best language has been right under our nose the whole time: the Unix shell.

    Continue reading…

  • What is a programmable programming language?

    When I was still researching this fabled obscure language called Lisp one thing people kept saying about it is that “Lisp is a programmable programming language”, but I could never figure out what they meant by that. It sounds like a smug buzzword or like a gimmick from an academic toy language. Lisp programmers have gotten so used to metaprogramming in Lisp that they seem to forget that it is either an entirely alien concept to people, or something people have been burned by too often (like every C programmer).

    Continue reading…

  • Understanding 2D rotation matrices

    When I first learned about rotation matrices they appeared quite “magic”; if you squinted your eyes a bit it sort of made sense, and if you did the math you could prove that the matrix does indeed perform the rotation and that all the group properties are met, but none of that explains where that form comes from, why it works. In this blog post I will explore a way to derive the formula for rotation matrices step by step. If you wish to follow along you need only basic knowledge of linear algebra and trigonometry.

    Continue reading…

  • Mirroring a GitLab repository

    I use GitLab to host my various projects, but it is always a good idea to be able to have an automatic mirror set up. It adds redundancy in case something goes wrong with GitLab, and having a mirror on a popular site like GitHub allows people to file issues without signing up for a less popular service. I am writing this down for myself so I don't have to figure out how to set up a mirror every time anew. This was written for GitLab version 12.0.0.

    Continue reading…

  • Singleton objects in Guile Scheme

    When I wrote guile-messagepack I needed an object to represent the nil value, which embodies the concept of "nothingness" or "no value" in MessagePack. None of the existing objects like #f or '() were adequate, so I decided to make a new one: nothing. It does not make sense for there to be multiple instance of nothing, so it had to be a singleton. In this blog post I will describe a way of creating such a singleton.

    Continue reading…

  • A purely functional fixed timestep loop

    There is a great article by Glenn Fiedler titled “Fix Your Timestep!” in which the author explains various approaches to writing a game loop and concludes with a loop that provides a fixed time step for simulation. If you are not familiar with this topic go read the article first and come back later. The author has written the implementation in C or C++ using a lot of mutation and looping, so I wanted to give a purely functional approach a shot.

    Continue reading…

  • Creating a mock REPL on Unix

    During the development of REPL.nvim I had to be able to test the plugin without relying on any particular REPL present on the development system. The solution was to create a mock REPL, a shell script which acts like a really dumb REPL. Here is the code:

    Continue reading…