Useful UNIX API:s

- 2 mins read

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 two decades, 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 :-)

En vanlig dag på jobbet (SWEDISH)

- 3 mins read
I vanlig ordning bashar vi DNS på jobbet, pga ofungerar hårt över VPN för de flesta. (Ja vi kör alla Linux, utom cheferna som envisas med att använda något ur gamla testamentet.) Här följer ett utdrag från vår IRC: 14:32 <n00b> Success! Äntligen fick jag ordning på DNS via guest wifi -> vpn -> office network. Firar med att skapa lite irc noise. :D 14:32 < rooth>n00b: Du har väl fått den distribuerade /etc/hosts filen?

Awesome: Changing Next/Prev Tune in Spotify

- 1 min read
Back to using the Awesome WM in Ubuntu. This time I’m setting up everything from scratch and first up is fixing keybindings to control my main music player: Spotify! Edit your ~/.config/awesome/rc.lua with Emacs (obviously). If you do not have an rc file, simply copy the system /etc/xdb/awesome/rc.lua: globalkeys = awful.util.table.join(globalkeys, awful.key({}, "XF86AudioRaiseVolume", function () awful.util.spawn("amixer -D pulse sset Master 5%+", false) end), awful.key({}, "XF86AudioLowerVolume", function () awful.util.spawn("amixer -D pulse sset Master 5%-", false) end), awful.

Stray Puppies

- 2 mins read
Sometimes I just cannot help myself. It’s like finding a stray puppy, or abandonded kitten … … I recently decided to adopt mini-snmpd since the original upstream site had passed into the great beyond. At this point in my life almost everyone I know can tell you I have no warm fuzzy feels for SNMP, at all. So why did I even consider this to begin with?! Well, I have to confess that there are certain things that SNMP can be really useful for.

HowTo run pimd on FreeBSD

- 2 mins read
This is not a proper HowTo, more of a “note to self” after having created a setup to test pimd issue #57. For these notes the following virtual topology, running on Ubuntu 15.10 with Linux 4.2 and Qemu 2.3.0, is used: .--------. net1 .----. net2 .----. net3 .----------. | Sender |------| R2 |------| R3 |------| Receiver | '--------' '----' '----' '----------' The networks between the boxes are actually Linux bridge devices (br), on which you may have to disable IGMP/MLD snooping to get pimd to run smoothly.

Summer of Code 2015

- 2 mins read
Summer is now slowly fading away, and what a summer it has been here in Sweden! For someone who isn’t a fan of the summer heat it has been an awesome time for brain work, and in my case work on my open source projects! :-) Due to my not really taking much vacation previous years I had saved up for ten weeks (10) this year! It was really worth it, and for the first time in many years I actually feel rested.

HowTo use NetBSD pre-built packages

- 1 min read
Reminder to self: you need to set up the PKG_PATH to the correct FTP URI. Also, use the correct ARCH, otherwise the installer complains. Do not use amd64, but rather x86_64. Here it is, you’d think this be something the installer could set up a default for … PKG_PATH=http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/6.1.5/All/ or if you use the latest on an old ThinkPad T42: PKG_PATH=http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/i386/9.0/All/ The simply pkg_add -v git Or so you might think!

HowTo run pimd on OpenBSD

- 6 mins read
This is an introduction to HowTo run pimd on OpenBSD. I keep it around mostly as a reminder to myself when testing new pimd releases, maybe someone else can make use of it as well. First of all, my sincere thanks to the OpenBSD team for, not just an awesome UNIX distribution, but also for their good taste in shipping a MULTICAST enabled kernel in the base distribution! On both NetBSD and FreeBSD there is a bit of work to get multicast support, which is one of the reasons for my not writing a HowTo for either of them atm.

Years ago while looking for a fast init replacement for work, I found Finit. Originally written by Claudio Matsuoka to act as a drop-in replacement for the Asus EeePC fastinit, “gaps filled with frog DNA …”

Until I found Finit I had always been in awe of those venturing into the realm of PID 1. However, learning from the simplicity of Claudio’s code I realized that although PID 1 at times is indistinguishable from magic, it is really not that hard to master. My version of Finit is available on GitHub.

The code is open sourced under the very liberal MIT/X11 license, and much of its frog DNA has proven very useful to me over the years. This blog post is about how that frog DNA can help you fill gaps in your projects …

So, now that I have http://git.troglobit.com setup as a backup GIT repo to https://github.com/troglobit, I needed a simple way to always push to both repos – best way for me is to always hook into my regular work flow, otherwise I’d just forget. The git-remote(1) man page to the rescue, it describes the set-url --add sub-command:

git remote set-url --add origin ssh://git.troglobit.com:1234/srv/git/watchdogd.git

Now, with a simple git push followed by git push --tags I had now pushed to both the GitHub repo as well as my own server!