Electricmonk

Ferry Boender

Programmer, DevOpper, Open Source enthusiast.

Blog

Category: programming

Merging two Python dictionaries by deep-updating

Say we have two Python dictionaries: { ‘name’: ‘Ferry’, ‘hobbies’: [‘programming’, ‘sci-fi’] } and { ‘hobbies’: [‘gaming’] } What if we want to merge these two dictionaries such that “gaming” is added to the “hobbies” key of the first dictionary? I couldn’t find anything online that did this already, so I wrote the following function […]

HTTP Error 429 on Reddit

Getting HTTP error 429 when trying to call Reddit APIs or .json endpoints? Try changing your User Agent header to something else. Reddit bans based on user agent.

How to solve RPMs created by Alien having file conflicts

I generate release packages for my software with Alien, which amongst other things converts .deb packages to .rpm. On Fedora 24 however, the generated RPMs cause a small problem when installed with Yum: Transaction check error: file / from install of cfgtrack-1.0-2.noarch conflicts with file from package filesystem-3.2-20.el7.x86_64 file /usr/bin from install of cfgtrack-1.0-2.noarch conflicts […]

Reliable message delivery with Mosquitto (MQTT)

I was looking for a message queue that could reliably handle messages in such a way that I was guaranteed never to miss one, even if the consumer is offline or crashes. Mosquitto (MQTT) comes very close to that goal. However, it wasn’t directly obvious how to configure it to be as reliable as possible So this […]

Ansible-cmdb v1.19: Generate a host overview of Ansible facts.

I’ve just released ansible-cmdb v1.19. Ansible-cmdb takes the output of Ansible’s fact gathering and converts it into a static HTML overview page containing system configuration information. It supports multiple templates (fancy html, txt, markdown, json and sql) and extending information gathered by Ansible with custom data. This release includes the following bugfixes;: Always show stack trace on error and […]

Multi-repo Git status checking script

I’ve got a whole bunch of Git repositories in my ~/Projects/ directory. All of those may have unstaged, uncommitted or unpushed changes. I find this hard to keep track of properly, so I wrote a script to do this for me. The output looks like this: As you can see, it shows: Untracked files: File that […]

Very fast MySQL slave setup with zero downtime using rsync

Most online tutorials for setting up a slave replication database involve dumping and loading the database on the master with mysqldump. Unfortunately, loading data with mysqldump can be very slow. My friend Cris suggest a much faster method using rsync. Benefits The benefits of this method are: Very fast setup of a slave by avoiding […]

cfgtrack: A simpel tool that tracks and reports diffs in files between invocations.

Sometimes other people change configurations on machines that I help administer. Unfortunately, I wouldn’t know when they changed something or what they changed. There are many tools available to track configuration changes, but most are way overpowered. As a result they require too much time to set up and configure properly. All I want is […]

Exploring UPnP with Python

UPnP stands for Universal Plug and Play. It’s a standard for discovering and interacting with services offered by various devices on a network. Common examples include: Discovering, listing and streaming media from media servers Controlling home network routers: e.g. automatic configuration of port forwarding to an internal device such as your Playstation or XBox. In this […]

Alien Deb to RPM convert fails with error: “Use of uninitialized value in split…” [FIXED]

TL;DR: Run alien under the script tool. I was trying to get my build server to build packages for one of my projects. One step involves converting a Debian package to a RPM by means of the Alien tool. Unfortunately it failed with the following error: alien -r -g ansible-cmdb-9.99.deb Warning: alien is not running as root! […]

The text of all posts on this blog, unless specificly mentioned otherwise, are licensed under this license.