Skip to content

Instantly share code, notes, and snippets.

View bobvanderlinden's full-sized avatar

Bob van der Linden bobvanderlinden

  • The Netherlands
View GitHub Profile
bobvanderlinden /
Last active April 7, 2024 11:00
devenv+python+git regression

devenv git+python regression

This is an example where devenv+python will fail when the git binary from the system is based on an older libc than the libc that is used in devenv. The system git is provided here by nix develop . to simulate an older system.

$ nix develop .
# This loads an older version of git (based on an older libc).
$ devenv shell
# This uses python to run `pip install -r requirements.txt` and will try to clone a git repository from there.
# Python uses a newer libc, which is passed through to subprocesses using `LD_LIBRARY_PATH` to `git`. `git` cannot run because of an incompatible libc.
bobvanderlinden /
Created May 15, 2023 20:32
devenv.yaml JSON Schema

Add to the top of devenv.yaml:

# yaml-language-server: $schema=<url/path to devenv.schema.json>
bobvanderlinden /
Last active July 20, 2022 09:59
Rename Git commits in batch using interactive rebase

When working on a merge/pull request and want your Git commit history to look nice afterwards, you often need to rename commit messages. For larger merge/pull requests you might need to rename a bunch of them.

The git rebase interactive reword command comes close, but it only allows you to change commit messages one by one in sequence, instead of changing the messages in an editor in one go.

Below is the most practical way of rewriting the commit messages I have found. It uses git interactive rebase, vscode and multiple cursors.

Note that the method below doesn't work for multiline commit messages!

bobvanderlinden / Dockerfile
Last active October 13, 2021 06:52
docker-compose host access test
FROM ubuntu
RUN apt-get update
RUN apt-get -y install netcat
CMD nc -zv -w 1 $ADDRESS 8888
bobvanderlinden /
Last active May 14, 2020 13:13
NodeJS HTTP server one-liner
node --eval 'require("http").createServer((req, res) => { res.end(); console.log(req.method, req.url, req.rawHeaders); }).listen(8080)'
bobvanderlinden / experiment.lua
Created October 30, 2019 16:40
HTTP path pattern matching for HAProxy using LUA
local function matches(input, pattern)
local index = 1
return function()
local match = input:match(pattern, index)
if match then
index = index + match:len() + 1
return match
return nil
bobvanderlinden /
Last active March 9, 2023 16:39
Example GraphQL call towards GitHub using curl and jq

This is an example how to do GraphQL queries in a somewhat sane way in bash using curl and jq.

The example does an query towards GitHub to fetch the commit SHAs of open pull requests for a specific repository.

The example needs the environment variables REPO_OWNER, REPO_NAME and GITHUB_TOKEN to be set.

bobvanderlinden /
Created November 30, 2018 20:48
Ad-hoc dnsmasq DHCP server

This script is handy for setting up an ad-hoc DHCP server for instance when starting up a Raspberry PI for the first time. dnsmasq will output when it has given a client an address:

dnsmasq-dhcp: DHCPACK(enp0s25) b8:27:eb:86:2f:ed nixos
This file has been truncated, but you can view the full file.
these derivations will be built:
these paths will be fetched (95.06 MiB download, 553.67 MiB unpacked):
bobvanderlinden /
Last active March 10, 2023 03:13
Running Rails through nix-shell

Use the following to generate gemset.nix:

nix run nixpkgs.bundix --command bundix

Then run: