Skip to content

Instantly share code, notes, and snippets.

View phobos182's full-sized avatar

Jeremy Carroll phobos182

View GitHub Profile
#!/bin/bash
#
# constants
IFACE=eth0
TX_QUEUE_LEN=5000
RPS_FLOW_CNT=32768
QUEUES=$(ls -d /sys/class/net/${IFACE}/queues/rx-* | wc -l)
RPS_FLOW_QUEUE=$((RPS_FLOW_CNT / QUEUES))
# set global flow queue
Statistics for BinaryTreeDictionary:
------------------------------------
Total Free Space: 542384916
Max Chunk Size: 337614532
Number of Blocks: 58933
Av. Block Size: 9203
Tree Height: 124
Before GC:
Statistics for BinaryTreeDictionary:
------------------------------------
@phobos182
phobos182 / zk-report
Created October 6, 2014 17:21
ZooKeeper zkTraffic report viewer.
#!/usr/bin/env python
import argparse
import brood
import requests
ENDPOINT_ADDR = '127.0.0.1'
ENDPOINT_PORT = 7070
TOP_ITEMS = 10
@phobos182
phobos182 / mpstat_output
Last active August 29, 2015 14:05
Blog MPStat Output
11:11:48 PM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %idle
11:11:49 PM all 6.38 0.00 19.15 0.00 0.00 12.41 2.84 0.00 59.22
11:11:49 PM 0 15.24 0.00 41.90 0.00 0.00 33.33 0.95 0.00 8.57
11:11:49 PM 1 1.70 0.00 5.68 0.00 0.00 0.00 3.41 0.00 89.20
---
12:14:40 AM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %idle
12:14:43 AM all 5.93 0.00 13.92 0.11 0.00 6.69 0.27 0.00 73.09
12:14:43 AM 0 19.87 0.00 38.41 0.00 0.00 41.06 0.00 0.00 0.66
@phobos182
phobos182 / elasticsearch.py
Last active August 29, 2015 13:58
Example ES Client
import elasticsearch
# Connect to cluster at search1:9200, sniff all nodes and round-robin between them
es = elasticsearch.Elasticsearch(["dataelasticsearch-a-master001:9200", "dataelasticsearch-b-master001:9200",
"dataelasticsearch-e-master001:9200"], sniff_on_start=True)
# Index a document:
es.index(
index="my_app",
@phobos182
phobos182 / hb-test.py
Created April 10, 2014 21:40
HeartBeat PoC
#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
@phobos182
phobos182 / patched.py
Last active August 29, 2015 13:58
patch detection
#!/usr/bin/env python
import argparse
import re
import sys
import subprocess
LIBSSL_NAME = 'libssl1.0.0'
LIBSSL_MODULE = 'libssl.so.1.0.0'
OPENSSL_NAME = 'openssl'
VERSION_WHITELIST = ['1.0.1-4ubuntu5.12']
@phobos182
phobos182 / keybase.md
Created March 20, 2014 23:41
keybase

Keybase proof

I hereby claim:

  • I am phobos182 on github.
  • I am jeremycarroll (https://keybase.io/jeremycarroll) on keybase.
  • I have a public key whose fingerprint is 77F0 B959 DAD0 3A5A F4F7 1E79 298A CF13 2ECF 0BF9

To claim this, I am signing this object:

@phobos182
phobos182 / format.py
Last active December 16, 2015 12:58
Format ephemerals at EXT4 on boot (upstart)
#!/usr/bin/python
import boto
import boto.utils
import subprocess
import logging
import re
import sys
import os
import psutil
import time
@phobos182
phobos182 / diamond
Created November 20, 2012 22:48
diamond binary
#!/usr/bin/python
import os
import sys
import configobj
import pwd
import grp
for path in [
os.path.join('opt', 'diamond', 'lib'),