A Guide on Generating Erlang Forms

2023-04-21

An advanced feature of Erlang is to write code that generates a module. This feature is possible because the Erlang standard library exposes functions that work with Erlang AST. Generating forms is different from Elixir, Scheme, or Clojure macros. However, honing this skill allows Erlang developers to generate code they don’t have to write themselves. This technique is in erlydtl templates, parse_transform, etc. This feature is powerful but has a learning curve.

Continue reading 


Erlquery: Native Query DSL's In Erlang

2022-12-14 | #database #dsl #erlang #query

The Problem: ORMs and Static String Queries Dealing with static strings when writing queries for a database is annoying. Historically, people have reached for ORMs to handle this problem. ORMs can be very convenient. However, in my experience, there is always a mismatch between the ORM and DSL. You must drop back into the DSL when you want to do something that the ORM API doesn’t support. Over time, I’ve come to embrace the DSL.

Continue reading 


zkc: My Zettelkasten Utility

2022-12-14 | #c #zettelkasten

One of the goals of zkc was to be faithful to the original text of Zettelkasten. Despite all the different writings of Zettelkasten, the original version will always be the best reference point. You can find an English translation here. My summary of that text is that your note system has to be a completely flat hierarchy. Forget about a million nested folders. This system needs to be easily searchable and focus on communication.

Continue reading 


Greetd + Sway + Alpine

2021-06-21 | #alpine #greetd #linux #sway

In this post, I’ll go step by step on how to install and use greetd with Sway on Alpine Linux. The greetd project is fairly new so documentation is sparse. Hopefully, this will help others on their journey towards a lightweight and modern desktop environment. While there are other greeters/login managers that might work. Alot of them depend on their respective desktop environment frameworks. For example, the Alpine package for gdm3 will install 200 dependencies.

Continue reading 


Setup Yggdrasil on Alpine Linux

2021-01-29 | #alpine #linux #yggdrasil

I love to use Alpine Linux because it is small and efficient. However, one tradeoff is that not everything works out of the box like on say Ubuntu. When I was experimenting with Yggdrasil I had no problem with Debian, but Yggdrasil ran into some issues on Alpine. Luckily, this is easy to fix. It took more digging than I would’ve liked so here is this post. All of the steps below assume you are running as root, so make sure you can get root access of the machine you are working with.

Continue reading 


Basics of LMDB with C

2020-09-06 | #c #database #lmdb

LMDB is a neat embedded key value database. It stands for Lightning Memory-Mapped Database. It is useful for small applications where you don’t have to worry about schemas or relations. Think of the usecase where you might use a hashmap but you want the state to be persistent. LMDB is written in C and is even able to be linked with pkgconfig. A lot of times people use a wrapper, but I wanted to see what it was like to use this directly with C.

Continue reading 


Survey of Rust CLI Utilities

2020-03-29 | #cli #rust #unix

In this post I wanted to go over a few CLI utilities written in Rust that I am excited about. There are a lot of different Rust CLI tools out there, but I wanted to focus on ones that replace some of the GNU Core Utilities with Rust alternatives. The tools I will be talking about are exa, ripgrep, and bat. You may be wondering why would you need alternatives for trusted utilities that have been around for decades?

Continue reading 


Make Your Own less in C

2020-03-29 | #c #less #unix

Lately, I’ve had a new appreciation for minimalist C applications. There is a certain Zen quality about C that I really like. Knowledge of the possible “footguns” actually makes me more focused and insistent on writing good code. It is a bit like weight training but for programmers. Coding in other languages like Python feels trivial after spending a bit of time wrangling some C. less is one of the original Unix terminal applications for viewing files.

Continue reading 


Compile a Hello World example in C with musl and tcc

2020-03-29 | #c #linux #musl #tcc #void

Continuing my exploration of suckless tools I wanted to try compiling a program with tcc and musl. tcc stands for Tiny C Compiler, and musl is a lightweight libc alternative to glibc. I was generally sold on the principal of these tools, but I could not for the life of me find documentation on how to get these two working together. Turns out it is rather quite trivial if you use the right OS.

Continue reading 


DIY Internet Radio

2020-03-29 | #darkice #go #icecast2 #nginx #radio

This post will layout the steps for setting up an internet radio using only Debian packages. The last part of it will go over how to create a Golang proxy server to make a fun website to host your stream. One of my other hobbies besides programming is music. I love listening to music, making music, and even curating music. One thing I’ve always wanted to participate in is a silent disco, either as a listener or a DJ.

Continue reading 