Skip to content

Instantly share code, notes, and snippets.

@bldewolf
bldewolf / gist:9244322
Created February 27, 2014 04:19
Good job, time warner
$ tracepath bloodlust
1: cpe-76-95-322-261.socal.res.rr.com 0.123ms pmtu 1500
1: cpe-76-95-322-1.socal.res.rr.com 50.732ms
1: cpe-76-95-322-1.socal.res.rr.com 21.693ms
2: tge7-1.pomncako02h.socal.rr.com 56.495ms
3: tge0-10-0-6.ontrcacp02r.socal.rr.com 18.775ms
4: sndhcaax-ccr07.socal.rr.com 39.759ms
5: agg1.lsaicaev02r.socal.rr.com 16.464ms asymm 6
6: agg10.lsaicaev01r.socal.rr.com 19.488ms asymm 5
7: agg26.lsancarc01r.socal.rr.com 19.397ms asymm 4
@bldewolf
bldewolf / radvd-update.pl
Last active August 29, 2015 13:58
dibbler-client/radvd integrator
#!/usr/bin/perl
use warnings;
use strict;
use File::Compare;
open(my $dib, "/etc/dibbler/radvd.conf") or die "Failed to open dibbler config: $!";
my $int; # current interface
@bldewolf
bldewolf / man-gler.pl
Last active August 29, 2015 13:58
Script that mangles input by replacing words with "equivalents" found via dictd/moby-thesaurus
#!/usr/bin/perl
use strict;
use warnings;
use IO::Socket;
my %options;
my %words;
my $sock;
@bldewolf
bldewolf / dumbconn.pl
Last active August 29, 2015 14:00
State table exploder
#!/usr/bin/perl
#
# Tired of your firewall working? Want to have new connections mysteriously
# rejected? Look no further! Use this handy script to flood your iptables
# nf_conntrack table with useless entries!
#
# Originally used to verify nf_conntrack_max settings. Empirically determined
# that 1 million states ~= 500MB.
@bldewolf
bldewolf / local.network
Created May 14, 2014 01:19
systemd networkd config example
[Match]
Name=eth0
Host=thishostduh
[Network]
DHCP=true
[DHCPv4]
UseMTU=false
UseHostname=false
@bldewolf
bldewolf / netdisco_depgraph.pl
Created June 26, 2014 23:54
Netdisco 1.x to Nagios config with dependencies generator
#!/usr/bin/perl
#
use warnings;
use strict;
use lib "/var/lib/netdisco";
use netdisco qw/:all/;
config("/var/lib/netdisco/netdisco.conf");
@bldewolf
bldewolf / colorprompts.sh
Last active August 29, 2015 14:13
256 color per-host foreground color picker
#!/bin/bash
# source me, I'm a shell script!
function _foreground_calc {
# reject these colors for being too dark
local reject=([0]=a [16]=a [17]=a [18]=a [19]=a [232]=a [233]=a [234]=a [235]=a [236]=a [237]=a [238]=a)
echo "$1" | shasum | while read -n2 num; do
local num=$((16#$num))
if [ -z "${reject[$num]}" ]; then
@bldewolf
bldewolf / tracetosmoke.pl
Created June 10, 2011 19:31
traceroute output to smokeping config converter
#!/usr/bin/perl
use strict;
use warnings;
my @s;
my $hop = 0;
while(<>) {
chomp;
@bldewolf
bldewolf / calcram.py
Created August 21, 2012 06:37
Pull down a calendar file and merge it into a local one
#!/usr/bin/python
import vobject
import sys
import os
from urllib import urlopen
# Hack for RFC violations
vobject.icalendar.escapableCharList = '\\;,Nn"\'&'
@bldewolf
bldewolf / gist:6243393
Last active December 21, 2015 03:38
Messing around with MBRs
Messing around with MBRs is fun. For example, you can make overlapping
partitions. Well, not with fdisk, of course. You need to make the volume to
clone first, then shuffle it around with dd like so:
dd if=/dev/sda bs=1 skip=446 seek=462 of=/dev/sda count=16
dd if=/dev/sda bs=1 skip=446 seek=478 of=/dev/sda count=16
dd if=/dev/sda bs=1 skip=446 seek=494 of=/dev/sda count=16
Once this is done, kick the kernel to reread the MBR (I usually do this with
fdisk because it amuses me that it will read and save this wacky partition