Skip to content

Instantly share code, notes, and snippets.


Daniel Nägele debugloop

View GitHub Profile
#!/usr/bin/env python
import ipaddress
class TrieNode:
def __init__(self, version=6, root=False):
self.lnode = None
self.rnode = None
self.content = None
self.__root = root
self.version = version
debugloop / gist:d77d35cd5f53f2d462c546586715b7e6
Created Sep 30, 2019
promql query to compare to global avg
View gist:d77d35cd5f53f2d462c546586715b7e6
# take the sum of the rate, leave stuff in irrelevant labels alone
# maybe use delta instead of rate to make it sign-aware
sum without (stuff) (rate($metric[1d]))
# ignore the instance on this side of the compare, would be even better without the instance of interest
ignoring (instance, stuff) group_left()
avg without(instance, stuff)(rate($metric[1w]))
# just give that some more breathing room
#!/usr/bin/env python3
import ipaddress
import datetime
from confluent_kafka import Consumer
from ssl import get_default_verify_paths
# The following needs to be available in PYTHONPATH
import flow_messages_enriched_pb2 as api
debugloop / tmux-window-names.zsh
Last active Aug 29, 2015
Naming tmux windows for the hosts you ssh to
View tmux-window-names.zsh
# The following snippet goes into your .zshrc
# You probably want to set all occurrences of 'local' to your preferred default name.
# This also works well when replacing ssh with mosh or something similar.
# To set the default window name in your .tmux.conf, use this line
# set-option -g default-command "tmux rename-window local; zsh"
ssh() {
if [[ $(tmux display-message -p '#W') = "local" ]]; then
trap "tmux rename-window 'local'" INT PIPE EXIT # clean up after ctrl-c, broken pipes and other exits
debugloop /
Last active Aug 29, 2015
Howto make a USB Key bootable, with multiple images and with no fancy tools
  1. Format the stick with FAT32, mount and go to the mountpoint (./ refers to your mountpoint)
  2. Create your grub.cfg (example below) in ./boot/grub/grub.cfg
  3. sudo grub-install --no-floppy --boot-directory=./boot /dev/sdx (use the right device, duh)
  4. Test it with sudo qemu-system-x86_64 -m 512 /dev/sdx

This will show you your menu, but obviously nothing will boot. Create ./iso (or whatever you called it in your grub.cfg) and dump some images into it. The exact versions will not matter (get the paths right), but the distribution most probably will. The grub.cfg below includes the kernel lines GRUB needs to boot Debian, Ubuntu or Archlinux Installers as well as the GRML Live System from These are the ones I need, if you want some more/others try the comments below this gist or have fun picking together working GRUB kernel line magic :)

PS: Beware a long-standing bug in the Debian-Installer which causes the bootloader to be written to /dev/sda, which i