Skip to content

Instantly share code, notes, and snippets.

View sage-oli-wood's full-sized avatar

Oli Wood sage-oli-wood

  • Sage UK
  • Newcastle: ELSM Team
View GitHub Profile
@sage-oli-wood
sage-oli-wood / tinyserver.py
Created December 17, 2015 09:53
Can be launched on any port and dumps out what it receives for debugging purposes
import json
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
class MyHandler(BaseHTTPRequestHandler):
def do_GET(self):
print self.headers
print self.command
print self.path
print self.request_version
@sage-oli-wood
sage-oli-wood / gist:2d2e748d25a3cad6b86c
Created November 23, 2015 13:18
Set ulimits for performance testing load generating machines
Append to /etc/security/limits.conf
ubuntu core hard unlimited
ubuntu core soft unlimited
ubuntu data hard unlimited
ubuntu data sft unlimited
ubuntu fsize hard unlimited
ubuntu fsize soft unlimited
ubuntu nofile hard 999999
ubuntu nofile soft 999999
@sage-oli-wood
sage-oli-wood / gist:70e0931f037ea0aac132
Created November 5, 2015 17:38
F.Ugly way to push TCP network stats into DataDog. Can be run from a crontab entry
#!/bin/bash -eux
// set $DATADOGKEY to your API key
DATE=$(date +%s)
HOSTNAME=`hostname`
cat /proc/net/sockstat | grep TCP | cut -d":" -f2 |sed 's/^ //g' | awk '{print $1, $2"\n"$3, $4"\n"$5,$6"\n"$7,$8"\n"$9,$10}' > /tmp/stats.tmp
while read LINE; do
METRIC=$(echo $LINE | cut -d" " -f1)
VALUE=$(echo $LINE | cut -d" " -f2)
curl -X POST -H "Content-type: application/json" \