Generate All Boolean Array Combinations

While writing Go tests for goxplorer, I wanted to test all boolean flags combinations without having to cascade for loops. This first method came to mind: package main import ( "fmt" ) func stob(bf []bool, s string) { for i, b := range s { if b == '0' { bf[i] = false } else { bf[i] = true } } } func main() { bf := []bool{false, false, false, false, false} for i := 0; i < 32; i++ { b := fmt.

Publish Binary Releases on Gitlab

I switched to Gitlab when Github was bought by Microsoft. Call me extremist, stupid, and all the names you like, I personally felt the need to do it. And quite honestly, I’m pretty happy with that choice, Gitlab is an incredibly useful suite, we use the community version at work and would never go back. But there’s one thing that’s pretty annoying with Gitlab, their documentation organization. Honestly it’s like they don’t want you to figure out how to do things.

Yubikey, Suspend and Restore

Another one of those quickies that can save you some time. When my Linux laptop resumed from sleep, I was annoyed that DrDuh’s perfect Yubikey setup would throw me the following when I tried to SSH: sign_and_send_pubkey: signing failed: agent refused operation Seems like the key doesn’t like being put to sleep and woken up. Another annoyance, for some reason, also when waking up, laptop’s touchpad was disabled. So I put this little script in /lib/systemd/system-sleep:

Alpine, tmux and UTF-8

A quicky in case anybody has the same issue. I use pine / alpine as a mail client since my firsts steps on the UNIX/Linux world, it always served me well. Nevertheless, since a couple of weeks, I had this weird behavior where the mail content pager would not display accents (éàü…) while the mail list would! Worse, this inconsistent behavior only happened in tmux. I suspected something involving locales but no, everything was fine on this side.

Push Motion Image Capture to Telegram

I use the fantastic motion project to monitor my apartment activity when I’m not home (not happening until God knows when these days…). I wanted it to warn me when there’s movement more interactively than with a basic email. Telegram and its very well documented bot API is really perfect for this task, so I came up with the following motion configuration: on_picture_save /bin/sh /home/imil/bin/ %f and more importantly, the following script:

Change default svg color

Again at ${DAYWORK} I was working on a network diagram, and found this incredibly useful website that regroups thousands of svg icons for all the major brands. I use to create my diagrams, and whereas they have a tutorial on how to modify an svg color (fill property) within, it would not work as shown. I figured out there was a very simple method to specify an svg file default color: edit the file, and add fill="white" (or any color code like #fafafa).

HTTP flood drop with nginx

The other day at ${DAYWORK} we got hit by a simple yet efficient DDoS attack, basically, there were lots of regular HTTP queries with a specific query parameter but using either GET, POST or HEAD methods: - - [19/Mar/2020:17:26:11 +0000] "POST /?=Best_HTTP_Flooder_For_FREE_by_PassDDoS&9716 HTTP/1.0" 200 62861 "" Fortunately, the parameter was always the same, and as we use an nginx reverse proxy farm in front of our customer’s websites, we could deploy this simple trick in order to get rid of the attack:

Migrating from Hexo to Hugo

Brand new! I’ve wanted to switch from hexo to hugo for quite a long time for various reasons, one of them being I love golang and, well, let’s just say I don’t like javascript / node much. Also, hugo documentation is pretty well done, its author is a well known figure in the golang community, and last but not least, I find the overall workflow more simple and consistent.

Let's Encrypt certificates using LEGO

This post is more like a self-reminder on how I setup automatic SSL/TLS certificate renewal on my servers. I chose LEGO to handle my certificates renewal with Let’s Encrypt because it’s simple to use, has no dependency, great documentation and is worked on at a constant pace. I found this and this articles very useful, but they are outdated in their use of the tls and http parameters. So here are my notes.

Revive an old Neufbox 6 with OpenWrt

While this article might only have interest for french people, you might want to get yourself an inexpensive Neufbox 6 on eBay or the like to play with it, thus the english language. When I lived in France, my last Internet provider was SFR, it was (and still is) a fiber provider, and you got connected thanks to a box called the “Neufbox”. There were a couple of versions of this box that was pretty hackable and the provider was cool with it, you could even flash it with “opened” versions of their firmware, a modified OpenWrt.