Skip to content

Instantly share code, notes, and snippets.

View wolfeidau's full-sized avatar
🐺
Building data science projects

Mark Wolfe wolfeidau

🐺
Building data science projects
View GitHub Profile
@wolfeidau
wolfeidau / execsnoop.d
Created March 9, 2013 01:44
My slightly modified version of execsnoop.d this currently only looks at exece system calls.
#!/usr/sbin/dtrace -s
/*
** execsnoop.d - snoop process execution as it occurs.
** Written in DTrace (Solaris 10 build 51).
**
** NOTE: This version is deprecated. See "execsnoop",
** http://www.brendangregg.com/dtrace.html
**
** 27-Mar-2004, ver 0.60
**
@wolfeidau
wolfeidau / testing out dtrace.md
Created March 12, 2013 07:58
Messing around with dtrace and node.

Monitoring a process which was exec'd using the -c switch.

$ pfexec dtrace -n 'profile-97/pid == $target && arg1/{@[jstack(100, 8000)] = count(); } tick-60s { exit(0); }' -c node
dtrace: description 'profile-97' matched 2 probes
> dtrace: pid 79919 has exited


              node`ares__read_line
              node`_ZN4node10cares_wrapL10InitializeEN2v86HandleINS1_6ObjectEEE+0x6a
@wolfeidau
wolfeidau / online.js
Created March 14, 2013 03:57
Online variance algorithm
exports.update = function (accumulator, value) {
accumulator.n++;
var delta = value - accumulator.mean;
accumulator.mean += delta / accumulator.n;
accumulator.m2 += delta * (value - accumulator.mean);
};
exports.variance = function (accumulator) {
return accumulator.m2 / (accumulator.n - 1)
};
@wolfeidau
wolfeidau / levelcli.js
Created March 17, 2013 06:45
Dumps a given leveldb database when passed the directory path. ./bin/levelcli.js --dump -d ./test/db
#!/usr/bin/env node
var optimist = require('optimist');
var pkgInfo = require('../package.json');
var fs = require('fs');
var levelup = require('levelup')
var argv = optimist
.alias('d', 'data')
.describe('d', 'Data directory path')
@wolfeidau
wolfeidau / out.log
Created March 18, 2013 05:52
He said levelup was safe..
trogdor:lev markw$ node lev ../datum/temp/datum_store4/
compression = true
encoding = json
keyEncoding = json
valueEncoding = json
levelup version = 0.7.0-b02
...p/datum_store4/>
Encoding not compatible with json
@wolfeidau
wolfeidau / gist:5195063
Created March 19, 2013 10:25
dtrace stacks output
0xaa7ffd
0x99f9a9
0x8f2e78
0x8f3fd6
0x8f4206
0x9b35bb
0x9bee50
@wolfeidau
wolfeidau / systemtap.md
Last active October 29, 2018 15:43
Configuring system tap on ubuntu 13.04, yeah so it will work.. like at all..
  • Install a base server with open ssh server enabled.
  • Update the OS.
sudo apt-get update
sudo apt-get upgrade
  • Install developement tools.
@wolfeidau
wolfeidau / ninjablock_debugging.md
Last active December 16, 2015 17:40
Ninja Block debugging

#Ninja Block Debugging

I am building a list of handy commands which I use to work out what the hell my block is doing.

Prerequisites

This is a list of handy system tools i install on my block.

sudo apt-get install lsof 
@wolfeidau
wolfeidau / networks.md
Created April 30, 2013 08:38
Bunch of commands to slow data into and out of an OSX host

Simulating slow networks

In this case I am testing slowing down traffic to 173.192.57.100 for http and https traffic.

sudo ipfw add pipe 1 ip from any to 173.192.57.100 out dst-port 443
sudo ipfw add pipe 1 ip from any to 173.192.57.100 out dst-port 80

Apply a bandwidth restriction of 10KB/sec on the pipe assocated with the previously listed rules.

@wolfeidau
wolfeidau / gist:5492354
Created April 30, 2013 22:13
Trace route to gstatic.com
$ traceroute gstatic.com
traceroute to gstatic.com (X.X.X.X), 64 hops max, 52 byte packets
1 fritz.box (X.X.X.X) 2.194 ms 1.726 ms 1.758 ms
2 lns20.mel4.on.ii.net (150.101.212.44) 31.827 ms 32.679 ms 32.132 ms
3 te2-2.cor3.mel4.on.ii.net (150.101.208.65) 32.543 ms 33.445 ms 31.714 ms
4 ae2.br1.syd7.on.ii.net (150.101.33.28) 48.787 ms 45.817 ms 49.045 ms
5 gw.google.com (150.101.199.234) 44.229 ms 45.947 ms 44.794 ms
6 66.249.95.224 (66.249.95.224) 45.787 ms 45.331 ms 45.238 ms
7 72.14.237.135 (72.14.237.135) 46.175 ms 45.975 ms 45.514 ms
8 syd01s12-in-f15.1e100.net (74.125.237.111) 44.155 ms 45.800 ms 44.944 ms