Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am benjojo on github.
* I am benjojo (https://keybase.io/benjojo) on keybase.
* I have a public key whose fingerprint is 2EDA 1044 EA0E 724F 21F0 FC14 AA8F D834 567F 8B8B
To claim this, I am signing this object:
@benjojo
benjojo / chomp.go
Created June 7, 2014 22:31
consumes robot.txt files and makes a json summery of them all
package main
import (
"encoding/json"
"fmt"
"github.com/cheggaaa/pb"
"io/ioutil"
"log"
"runtime"
"strings"
<?php
$files = glob('*.wma');
usort($files, function($a, $b) {
return filemtime($a) < filemtime($b);
});
echo('<?xml version="1.0" encoding="UTF-8"?>');
?>
<rss version="2.0">
<channel>
@benjojo
benjojo / spacemail.go
Created June 28, 2014 23:24
A client for spacemail
package main
import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
"strings"
)
@benjojo
benjojo / geel.py
Created May 11, 2015 19:25
~in jokes~
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
@benjojo
benjojo / icmp4.c
Created October 11, 2015 15:22
How to trigger SNMP counter bug
/* 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
@benjojo
benjojo / StatStream.go
Created November 12, 2015 23:38
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
package main
import (
"flag"
"github.com/tuxychandru/pubsub"
"golang.org/x/net/websocket"
"io/ioutil"
"net/http"
"strings"
)
#!/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 / config.boot
Last active April 19, 2017 21:22
Ubiquiti edge routers don't actually work with v6 sessions, they setup v4 sessions over v6 and then confuse upstream
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"
@benjojo
benjojo / main.go
Last active April 26, 2017 20:07
DNS TTL blogpost
package main
import (
"bufio"
"encoding/json"
"flag"
"fmt"
"log"
"os"
"strconv"