Useful UNIX API:s

Had an interesting conversation with a buddy last night. It started out as a shift-reduce problem with Bison and ended up a ping-pong of useful UNIX API:s. We concluded that despite having worked professionally with UNIX for over a decade, it is still very satisfying finding gems like these.

Most people are completely unaware they exist and end up rolling their own (buggy) implementations. For instance, string manipulation and various forms of linked lists. Which is why I many years ago extracted the frog DNA from Finit to a separate library called libite, or -lite for short. It imports the OpenBSD strlcpy() family of API:s, up-to-date queue.h with the _SAFE iterators, and more. Some people like libbsd for this, but I’ve found many of the ports incomplete and unsafe and prefer to stay closer to the upstream *BSD versions.

Update: This post was originally written Nov 14, 2015. It was a Saturday and I remember being extremely inspired when I wrote it. I’ve continued adding to it over the years, and still do. So, as of Jul 2, 2017 I’m bumping the modification date each time I add something new :-)

[Read More]

Set up a Debian/Ubuntu APT Repository

How to set up a Debian/Ubuntu APT repository with GPG signing.

At first I tried to use Bas Wijnen’s mini-dinstall howto, but never managed to get it working. Probably due to problems with GPG. Then I went down the tried and true path of using reprepro.

I’ve tried to document my steps here, but I’ve very likely missed a few steps that a beginner admin may run into. YMMV B-)

[Read More]

Threads vs Event Loop, Again ...

I still get asked this, from time to time. Maybe it’s because I only use event loops, maybe it’s because I’ve written libuEv, or maybe people still don’t understand:

Why an event loop, why not use threads?

So here’s my response, once more.

[Read More]

GIT, Autoconf and Automake in OpenBSD

Reminder to self:

echo "https://ftp.eu.openbsd.org/pub/OpenBSD/" >/etc/installurl
pkg_add git autoconf automake libtool

Select the latest versions, then add the following to ~/.profile:

AUTOCONF_VERSION=2.69
AUTOMAKE_VERSION=1.15
export AUTOCONF_VERSION AUTOMAKE_VERSION

With your selected versions, of course.

HTTPS proxy for Merecat httpd

This is a HTTPS proxy HowTo for Merecat httpd using pound and OpenSSL. Pound is a reverse proxy, load balancer, and HTTPS front-end for Web servers. It is available in Debian/Ubuntu and is very simple to set up: First install the package, including OpenSSL, or LibreSSL: sudo apt install pound openssl Use OpenSSL to create a self-signed certificate: mkdir ~/certs cd ~/certs openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert. [Read More]

Running ikiwiki in Merecat httpd

This is a HowTo for setting up ikiwiki with Merecat httpd. First install ikiwiki $ sudo apt install ikiwiki libcgi-session-perl libcgi-formbuilder-perl Follow the steps to setup a new Wiki or Blog. In this example we set up a wiki in our ~/public_html: $ ikiwiki --setup /etc/ikiwiki/auto.setup ... Successfully set up wiki: url: http://localhost/~jocke/wiki srcdir: ~/wiki destdir: ~/public_html/wiki repository: ~/wiki.git To modify settings, edit ~/home.setup and then run: $ ikiwiki --setup ~/home. [Read More]

Emulate an actual MTD device in Qemu

Having worked with Linux for the last 20 years, and embedded for more than ten of them, I’ve become quite a fan of virtualization in general and Qemu in particular.

Qemu is a fantastic little tool, created by the Open Source superhero Fabrice Bellard. It can be used to verify an embedded system without having to deal with the problems of actual HW until you really have to. Don’t get me wrong, HW excites me like any other nerd, but if the HW is new and shaky it can be quite a pain to develop higher level functions.

My holy grail is to have a 100% complete and accurate virtualization target per architecture to test my various software projects on. That’s why I created TroglOS.

[Read More]