Skip to main content

Rust, meet Python

Out of mere curiousity, I wanted to try out bindgen to generate a Rust interface to a C library. So I ran it against libpython, not really expecting that it would work, but you don't know until you tried, right? The fun part is: It does work, after defeating a few errors.

Read more…

Bash Script Coding Rules

I've been thinking about writing a Bash linter sometime. I don't know when exactly this'll happen, but here are the rules I'd like to see enforced by such a linter. These are also the rules I tend to follow when writing bash scripts, and I found that it improves both readability and stability.

Read more…

Pacemaker Resource Resurrection Guide

In case you're ever confronted with an active-passive high availability cluster managed by pacemaker (if the crm_mon command exists on your system, it probably is), it's 4am and you just need that damn service to work again, here's what you can try.

Read more…

Error handling is not an excuse for goto

In discussions about the infamous goto statement, people frequently point out that it's okay to use goto for error handling. The argument usually goes that without goto, you'd have to repeat your error handling code for each and every error condition that can occur, which would suck more than using goto. Both is wrong.

Read more…

Starting 1000 processes in parallel

I'm currently debugging a little server I've written, and I wanted to see what happens if thousands of clients connect to it at once. I've also written a little client app that I can run pretty easily, both in Python. But how do I run it a thousand times in parallel while still keeping control in case they go rogue in some way?

Read more…

LowTek Arduino CAN-Bus

I finally found a nice project that would give all my playing around with Arduino some focus. I've moved from standard boards to breadboard a while ago and I have a whole bunch of 'em, but didn't really know what to do with them. First and foremost, I didn't have an easy way to build a network of Arduinos -- and there's only so much to be done with a single one that can't really communicate to the outside world.

Fortunately, my employer is a company that builds embedded devices connected to a CAN Bus, and I decided to try and build one for myself. Such a network would then allow for a much wider range of interesting things to do. For starters, I'm going to control a Lego train — and I can even use my power supply for that!

So that's the idea. However, the "real" CAN bus seems to require a more complex hardware setup than seemed practical for reproducing across a set of breadboards, so I tried to find a way around that. The result: The Poor Man's CAN bus!

Read more…

Imageless VM builds with libguestfs

If you're running a VM cluster and regularly deploying new VMs, you'll have noticed that using a base image to build new VMs upon is just a fucking pain in the ass. It is indeed such a huge pain in the ass, that I had to spell this out three times in two sentences, just to clarify how much of a pain in the ass this is. Because you'll build the image, deploy it three times and notice that there's something you fucked up, that you'd like to change, and that gleefully involves just doing the whole thing over without fucking up anything else. Hence, you'll live with the buggy piece of crap because that's still easier than rebuilding the whole thing from scratch and you've got shit to do. At least, that's what I did. Until I got fed up with it and started building vmaker to get rid of the pain.

Read more…