erlpic

2024-11-03 | #c++ #camera #erlang #opencv

Lately I’ve been interested in learning about satellites and got inspired to make a simple IoT project. I can’t make my own satellite, but I could at least make a device to take periodic pictures. My idea was that since I’m not up to see the sunrise I would have this bot take pictures out my window in the morning. This project turned out to be both easier and harder than I initially thought, and it was fun learning experience.

Continue reading 


How To Send and Receive Patches Like A Hacker

2024-03-31

For the hackers who study the blade, the preferred method of collaborating is with email patches. Both git and email are decentralized. Git was initially designed around the idea of emailing patches. Then, the GitHub empire introduced the world to PR’s. Now, it dominates the way developers think about collaborating. The hacker art of email patches has nearly been wiped out. This blog post is meant to help other developers revive the lost art. More seriously, this is a workflow I have figured out while using SourceHut. In my experience, most blog posts focus on sending git patches while leaving receiving patches an exercise for the reader. In this post, I will dive into how you can use himalaya, the email client, to quickly receive patches and add them to your git log like a true hacker.

Continue reading 


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. For example, while thorough, the docs on Erlang’s abstract forms are opaque. This blog post will break it down and make it easier to understand.

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. If I’m using Postgres, then I’m writing Postgres SQL. If I’m writing SQLite, then I’m writing SQLite SQL. If I’m writing neo4j, then I’m writing Cypher. You get the idea.

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. I’ll go into more depth about that later.

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. Assuming you haven’t installed gnome yet. Well, I’m not running Gnome. I’m running Sway. I don’t want all those Gnome dependencies if I don’t really need them. Unfortunately, those extra packages are the backbone of the current modern Linux desktop experience. This post is part of my journey at providing a modern feel, without all of that extra stuff.

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. It isn’t difficult, but I found basic tutorials hard to come by. So in this post I’ll show you to store and retrieve string key value pairs.

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? Well, a few reasons. First, they are written in Rust! Which for me is reason alone to use them. Secondly, some of these tools are makeovers with pretty colors and sane defaults, and sometimes they are even faster than the original. Some of the effort behind these tools goes to support the RedoxOS project which I highly recommend checking out if you haven’t.

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. It is a good example of the Unix philosophy: “Do one thing, and do it well”. It differentiates itself from editors by not loading the entire file into ram. The wikipedia page has a very detailed explanation. If you haven’t used less before, I would recommend giving it a spin before continuing with the rest of this post.

Continue reading 