RSSAmplifier

Blog

Hugues Blog

/RSS feed ↗18 posts

Latest posts

Piping terminal output to the browser using systemfd

An opportunity I use systemfd in combination with watchexec to run a web server project with a tight development loop. While I'm using Rust and Cargo for the examples in this post, this technique works for any compiled backend language. The compiled program can reuse the already opened listening socket so web clients see no disruption (the socket is never closed). systemfd will keep the listening…

Allowlist for .gitignore

At my current job, while reorganizing our company's root git monorepo, we decided to adopt a .gitignore allowlist pattern. I had previously experimented with this approach on raconn , but this monorepo is significantly larger. The complexity required a dedicated script to generate the .gitignore file effectively. Why use an allowlist? Pros: Pure state: You know exactly what is being tracked and…

Raconn - Ssh multi hostname

TLDR: Raconn Introduction Recently I wanted to connect to a local machine with ssh but didn't know it's IP, I knew the MAC address which I could translate into the IPv6 link-local address but since the connect syscall requires the local iface name for ip6 link local, it would need to be hardcoded in the ssh config, making it inconvenient to change. Also if the same machine is accessible from a…

Nginx Explorer - Upload

After listing files and setting up per directory accesses , we would like to allow some users to upload files. This solution is very hacky, but it has the advantage of requiring only a standard nginx server and a bit of javaScript. Nginx Configuration First, we define our upload endpoint: ... server { ... location ^~ /___ngxp/upload/ { limit_except GET POST { deny all ; } if ($user_authorized = 0)…

Nginx Explorer - Cookie Authentication

Previously , we configured nginx to list directories and files in html. Now, let’s add authentication to restrict access to specific directories and files. Basic authentication The simplest web authentication method is basic authentication . It requires an Authorization header in each request. However, browsers don’t support setting a header on requests without javascript, and with javascript,…

Nginx Explorer - File listing

TLDR Nginx explorer is a minimal web interface for file download/upload using only nginx builtin modules. git clone https://github.com/izissise/nginx-explorer.git nginx-explorer/ngxp.sh download_icons nginx-explorer/ngxp.sh servethis Genesis Sharing files across devices can be a hassle. Luckily, most devices support HTTP through a browser, which enables both file download and upload. There are…

Modern PATH environment variable

The PATH environment variable is read by the shell or libc to find and execute programs, this is how the shell can find /bin/ls when ls is typed in a terminal. Shrink it On Debian based desktop systems the default PATH variable look like this: PATH = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games Much of this is not really necessary. First, on modern…

Git Config

Git can change configuration depending on the directory you're in. By using this feature, you can create a directory structure with context-aware Git configurations. Using includeIf in ~/.gitconfig : [include] path = "~/.config/git/main.gitconfig" [includeIf "gitdir:~/work/companyA/**"] path = "~/.config/git/companyA.gitconfig" [includeIf "gitdir:~/work/companyB/**"] path =…

Unified Kernel Image

Unified Kernel Image UKIs can run on UEFI systems and simplify the distribution of small kernel images. For example, they simplify network booting with iPXE. UKIs make rootfs and kernels composable, making it possible to derive a rootfs for multiple kernel versions with one file for each pair. A Unified Kernel Image (UKI) is a combination of a UEFI boot stub program, a Linux kernel image, an…

Edk2 UEFI Boot 0000

Edk2 Edk2 is the official UEFI implementation. One problem I encountered is that it doesn't provide a way to specify the default boot entry. If you already know what the default boot device or application should be, then it should be possible to set it in the 'to be flashed' file. Here I made a patch that add a PCD option to choose which entry will be Boot0000 , hence it will be booted first if no…

Qemu IPv6 Slirp

Qemu support rootless mode routing of network packets through the host using Slirp , you only need to give the right options to qemu to set this up, without having to tinker with tap interfaces or iptables. However, using it for IPv6 can be a bit more challenging, especially since the documentation lacks IPv6 examples. The Qemu options look like this -device…

Snap 2 Flatpak

Sometimes, I want to use closed-source applications on Linux. While I can usually find a Flatpak version, sometimes only a Snap package is available. For such cases, I've created a simple script https://github.com/izissise/snap2flatpak . It automatically downloads the Snap archive from the Ubuntu server and repacks it as a Flatpak. I haven't tested it with many apps, so you might need to tweak it,…

Binary Patching KWin for 3-Finger Overview Gesture

TLDR: Go to patching Plasma 6 I recently updated to Kde Plasma 6 , and it's great except for one minor annoyance: the overview effect is triggered on the touchpad with a 4-finger swipe, and I'd prefer to trigger it with a 3-finger swipe instead. Problem is, the value is hardcoded in the C++ code There is an issue about making it configurable but without someone assigned to it. If you want to help…

Video motion

I saw the following youtube video , I like the concept a lot but I only have ffmpeg . In the video we can make up five steps to extract the motion from a normal video set opacity to 50% duplicate video inverse colors on first duplicate time shift on second duplicate overlay duplicates After some trial and error, here's the ffmpeg command I came up with to achieve a similar effect: TIME_SHIFT = 0.8…

Initramfs

Linux basic initramfs With a compiled kernel image, it can be useful to load your own initramfs : make it as small as possible considering the features you need create a minimal test environment for the kernel image mount a remote filesystem as the root your own reason Anyways, with the official documentation help, let's create an initramfs. Tool compilation We need to gen_init_cpio tool that can…

Parallel bash function call

Introduction Now that we can execute bash functions remotly , we can scale the execution using GNU Parallel . When one wants to make a change or retrieve one particular piece of information on a whole set of machines, multiple choice are available (ansible, puppet, pssh, consul, ...) each with their own upsides and downsides. Parallel + ssh + func can give a combination of upsides that I haven't…

Remote bash function with ssh

Genesis Often when a shell command line start to become a little long, I like to break it down into functions. But things start to get complicated when it involve a remote host. It usually involve spawning a remote shell with ssh and then double escaping lot of characters (ssh and remote shell) in order to properly execute commands. Another solution exist though and it's usage it really simple,…

Network manager connection action

Genesis It as always been kind of a hassle to do actions upon connecting to a network using network manager, especially if you want your script to run a with user permissions. Maybe you work for multiple companies and you want to setup and run some program when connecting to their VPN. You could setup an up rule on your openvpn configuration but it would run as root, and only works for openvpn.…