Skip to content

Instantly share code, notes, and snippets.

@benjojo
benjojo / bpf-gen.c
Created May 26, 2019
very useful for quick IPtables, don't want to lose it again
View bpf-gen.c
/*
* BPF program compilation tool
*
* Generates decimal output, similar to `tcpdump -ddd ...`.
* Unlike tcpdump, will generate for any given link layer type.
*
* Written by Willem de Bruijn (willemb@google.com)
* Copyright Google, Inc. 2013
* Licensed under the GNU General Public License version 2 (GPLv2)
*/
@benjojo
benjojo / gist:4f4776d354a4f871018fe83ddf659612
Last active May 3, 2018
Zero BS Yubi Key as SSH Agent
View gist:4f4776d354a4f871018fe83ddf659612
sudo apt-get install -y gnupg2 gnupg-agent pinentry-curses scdaemon pcscd yubikey-personalization libusb-1.0-0-dev
mkdir -p ~/.gnupg/
echo "enable-ssh-support" >> ~/.gnupg/gpg-agent.conf
# then in your bashrc
export GPG_TTY="$(tty)"
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
gpgconf --launch gpg-agent
View routedumps.txt
route-views6.routeviews.org> show bgp ipv6 unicast regexp 206924
BGP table version is 0, local router ID is 128.223.51.112
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
* 2a07:1500:a4a::/48
2001:d98::19 0 18106 6939 206924 i
* 2001:1620:1::203
@benjojo
benjojo / cyberglobe.go
Last active Jul 16, 2017
CYBER GLOBE
View cyberglobe.go
package main
import (
"image/color"
"log"
"fmt"
"github.com/mmcloughlin/globe"
)
@benjojo
benjojo / main.go
Last active Apr 26, 2017
DNS TTL blogpost
View main.go
package main
import (
"bufio"
"encoding/json"
"flag"
"fmt"
"log"
"os"
"strconv"
@benjojo
benjojo / config.boot
Last active Apr 19, 2017
Ubiquiti edge routers don't actually work with v6 sessions, they setup v4 sessions over v6 and then confuse upstream
View config.boot
ben@edge# show protocols bgp
bgp 206924 {
address-family {
ipv6-unicast {
network 2a07:1500:4663::/48 {
}
}
}
neighbor 2001:470:11:a::1 {
description "HE BGP tunnel fucking pos"
View ioping.collectd.sh
#!/bin/bash
HOSTNAME="${COLLECTD_HOSTNAME:-ardar}"
INTERVAL="${COLLECTD_INTERVAL:-10}"
cd ~
stdbuf -oL ioping -i 1 -P 10 -W -q . | while read -r line
do
min=$(echo $line | awk '{print $5}')
@benjojo
benjojo / StatStream.go
Created Nov 12, 2015
Publish collectd stats over a websocket, with a grep option too for scripts, Could be used for any kind of publishing of data over websockets
View StatStream.go
package main
import (
"flag"
"github.com/tuxychandru/pubsub"
"golang.org/x/net/websocket"
"io/ioutil"
"net/http"
"strings"
)
@benjojo
benjojo / icmp4.c
Created Oct 11, 2015
How to trigger SNMP counter bug
View icmp4.c
/* Copyright (C) 2011-2015 P.D. Buchan (pdbuchan@yahoo.com)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
View geel.py
import pygtk
pygtk.require('2.0')
import gtk
class FirstWin:
def __init__(self):
self.win = gtk.Window(gtk.WINDOW_TOPLEVEL)
color = gtk.gdk.color_parse('#6495ED')
self.win.modify_bg(gtk.STATE_NORMAL, color)
# To change the color again, just modify it again