Skip to content

Instantly share code, notes, and snippets.

@berg
berg / keybase.md
Last active Aug 29, 2015
keybase.md
View keybase.md

Keybase proof

I hereby claim:

  • I am berg on github.
  • I am bdb (https://keybase.io/bdb) on keybase.
  • I have a public key whose fingerprint is CFA5 E015 C2B9 BB2B 4AEA 3FB5 34D2 5DC4 2B41 0C19

To claim this, I am signing this object:

@berg
berg / gist:9142463
Last active Mar 14, 2016
Comcast and Netflix now have a direct adjacency
View gist:9142463

Comcast and Netflix now have a direct adjacency

Looked at the host serving my Netflix streams today and noticed something new.

No clue if money is changing hands or not, and the return path is what actually matters, but it appears that Comcast and Netflix have reached some sort of agreement regarding direct interconnection.

$ traceroute -a 198.45.63.164
traceroute to 198.45.63.164 (198.45.63.164), 64 hops max, 52 byte packets
    (hops 1-2 redacted)
@berg
berg / stream-dump.py
Last active Dec 13, 2015
Dump an App.net stream to the console. Useful for debugging.
View stream-dump.py
import sys
import time
import json
import requests
endpoint = sys.argv[1]
while True:
r = requests.get(endpoint, stream=True, timeout=600)
View channel-poll.py
import os
import time
import requests
# export ADN_PROD_TOKEN="<your access token>"
token = os.environ['ADN_PROD_TOKEN']
s = requests.Session()
s.headers['Authorization'] = 'BEARER ' + token
@berg
berg / photo.md
Created Jul 25, 2012
Sketch of App.net image schema
View photo.md
@berg
berg / poll-snmp.py
Created May 14, 2012
Script to poll SNMP counters
View poll-snmp.py
#!/usr/bin/env python
#
# Script to poll Ethernet interface counters from a SNMP host
# requires pysnmp and the handy snmpclient library from
# https://github.com/seveas/python-snmpclient
#
# licensed under creative commons CC0 (public domain)
#
@berg
berg / gist:2651626
Created May 10, 2012
iptables rules
View gist:2651626
# iptables rules created
# flush forward rule
iptables -t mangle -F FORWARD
# match/count synthetic traffic
iptables -t mangle -A FORWARD -d 192.168.1.3
# match/count xbox traffic
@berg
berg / log.sh
Created May 10, 2012
Script to poll iptables counters
View log.sh
#!/bin/sh
# iptables counter poller
# released under CC0 (public domain)
while true; do
((date +%s; \
iptables -t mangle -x -L FORWARD -vvv -n \
| tail +3 \
| awk '{print $2}') \
@berg
berg / gist:2651577
Created May 10, 2012
Arris TM702G counter polling script
View gist:2651577
#!/usr/bin/env python
#
# Script to poll DOCSIS downstream channel counters
# on Arris TM702G cable modems and similar
#
# licensed under creative commons CC0 (public domain)
#
import functools
View gist:811726
#!/usr/bin/python
import urllib2
import json
import pprint
from poster.encode import multipart_encode
from poster.streaminghttp import register_openers
register_openers()