Skip to content

Instantly share code, notes, and snippets.

View nickpegg's full-sized avatar

Nick Pegg nickpegg

View GitHub Profile
auto lo
iface lo inet loopback
iface eth0 inet manual
iface eth1 inet manual
iface bond0 inet manual
slaves eth0 eth1
bond-mode balance-tlb
@nickpegg
nickpegg / mtr.py
Created February 15, 2014 14:28
This. Is. Awesome.
from sh import mtr
i = mtr("google.com", _iter=True)
for x in i:
print(x)
@nickpegg
nickpegg / gist:9084697
Created February 19, 2014 01:58
lg/Dockerfile
FROM ubuntu:12.04
RUN apt-get update
RUN apt-get install -y mtr-tiny iputils-ping python python-dev python-pip git build-essential
RUN pip install -r https://raw.github.com/nickpegg/lg/master/requirements.txt
RUN pip install uwsgi
ADD adduser.sh /
RUN /adduser.sh
### Keybase proof
I hereby claim:
* I am nickpegg on github.
* I am nickpegg (https://keybase.io/nickpegg) on keybase.
* I have a public key whose fingerprint is 2E55 A600 8865 7536 DC27 1E32 E60D 07B6 08CB 13F3
To claim this, I am signing this object:
@nickpegg
nickpegg / interfaces
Last active August 29, 2015 14:05
My router's /etc/network/interfaces file
auto lo
iface lo inet loopback
# outside
allow-hotplug eth0
iface eth0 inet dhcp
hwaddress ether AA:BB:CC:DD:EE:FF
dns-search home.nickpegg.com nickpegg.com
dns-nameservers 8.8.8.8 8.8.4.4
@nickpegg
nickpegg / rules.v4
Last active August 29, 2015 14:05
My router's Xtables rules
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
-A POSTROUTING -o eth0 -j MASQUERADE
COMMIT
*filter
:INPUT DROP [0:0]
:FORWARD ACCEPT [0:0]
@nickpegg
nickpegg / dhcp.conf
Created August 19, 2014 23:37
My dnsmasq configs
# My DHCP configs
dhcp-range=10.0.0.110,10.0.0.250,12h
# options for DNS
dhcp-option=option:domain-search,home.nickpegg.com,nickpegg.com
# Static DHCP entries
dhcp-host=00:24:1D:7D:5F:C3,10.0.0.10,host1
dhcp-host=88:30:8A:22:2E:74,10.0.0.11,host2
dhcp-host=00:23:54:1A:16:2D,10.0.0.12,host3
@nickpegg
nickpegg / hostapd.conf
Created August 23, 2014 00:25
My hostapd config
# Set up some logging. VERY useful to see why things aren't working.
logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=2
# Which interface to use and which bridge to join
interface=wlan0
bridge=br0
#!/bin/bash
# pingwatch.sh - ping a thing, if pings fail, log it and run an MTR
# first argument is the host to ping and MTR upon failure
# the rest of the arguments are additional hosts to MTR
if [ -z $1 ]; then
echo "You must supply a host to ping!"
echo "Usage: ./pingwatch.sh [host] [[mtr_host] ...]"
@nickpegg
nickpegg / test.py
Created October 7, 2014 17:04
Derping around with Construct - parsing TCP packets
#!/usr/bin/env python3
# Receives a TCP packet, destructs it, pretty-prints it
# Packet structures taken from here:
# http://en.wikipedia.org/wiki/IPv4#Header
# http://en.wikipedia.org/wiki/Transmission_Control_Protocol#TCP_segment_structure
import socket