Gitlab Pages Simply Put

Yet another topic IMHO explained in the most possible complicated way in Gitlab documentation, Gitlab pages are in fact extremely powerful and simple to use. In order to create a website with an URL of the form https://<username>.gitlab.io/<project>, there are a couple of steps to follow. First, write a Job to publish your pages, this job can be part of your project’s .gitlab-ci.yml but for some reason, official documentation gives the idea you are supposed to create a specific repository for that.

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/on_picture_save.sh %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 draw.io to create my diagrams, and whereas they have a tutorial on how to modify an svg color (fill property) within draw.io, 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: www.customer.com:443:80 174.76.48.233 - - [19/Mar/2020:17:26:11 +0000] "POST /?=Best_HTTP_Flooder_For_FREE_by_PassDDoS&9716 HTTP/1.0" 200 62861 "http://validator.w3.org/feed/check.cgi?url=https://www.customer.com" 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 iMil.net! 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.