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 / gist:3948453
Created October 24, 2012 20:00
winston HTTP transport output printed by a node server
2012-10-24 19:58:44 POST //notify
{ host: 'localhost:8000',
'content-type': 'application/json',
accept: 'application/json',
'content-length': '1858',
connection: 'keep-alive' }
Received body data:
{
"method": "collect",
"params": {
@wolfeidau
wolfeidau / gist:3978564
Created October 30, 2012 06:03
CrashLog request which failed.
{
"payload": {
"notifier": {
"name": "nodejsapp",
"version": "0.0.1"
},
"event": {
"message": "uncaughtException",
"type": "Error",
"timestamp": "Tue, 30 Oct 2012 06:34:27 GMT"
<VirtualHost *:80>
ServerName stage.moneytribe.com.au
ServerAdmin [email protected]
ErrorLog /var/log/httpd/stage.moneytribe.com.au_error.log
CustomLog /var/log/httpd/stage.moneytribe.com.au_access.log combined
DocumentRoot /var/www/html
<Directory "/var/www/html">
Options +FollowSymLinks Indexes
@wolfeidau
wolfeidau / gist:4291292
Created December 15, 2012 04:13
Levelup build for leveldb1.7
trogdor:node-levelup markw$ git pull git://github.com/rvagg/node-levelup.git leveldb1.7
remote: Counting objects: 13, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 7 (delta 5), reused 7 (delta 5)
Unpacking objects: 100% (7/7), done.
From git://github.com/rvagg/node-levelup
* branch leveldb1.7 -> FETCH_HEAD
Updating 7b907b0..4ff9822
Fast-forward
deps/leveldb/leveldb.gyp | 4 ++++
@wolfeidau
wolfeidau / gist:4303786
Created December 16, 2012 06:17
levelup intial dtrace
# cat syscalltime.d
syscall:::entry
{
k = probefunc;
}
tick-5000hz
/k != 0/
{
@[k] = count();
}
@wolfeidau
wolfeidau / gist:4314160
Created December 16, 2012 23:25
Macro issue with node ev.h
> [email protected] install /Users/markw/Code/Javascript/node-netif
> node-gyp rebuild
CXX(target) Release/obj.target/netif/src/netif.o
In file included from ../src/netif.cc:29:
In file included from /Users/markw/.node-gyp/0.8.14/src/node.h:61:
In file included from /Users/markw/.node-gyp/0.8.14/deps/uv/include/uv.h:61:
In file included from /Users/markw/.node-gyp/0.8.14/deps/uv/include/uv-private/uv-unix.h:27:
/Users/markw/.node-gyp/0.8.14/deps/uv/include/uv-private/ev.h:229:3: error: expected '}'
EV_ERROR = (-2147483647 - 1) /* sent when an error occurs */
@wolfeidau
wolfeidau / smartos.md
Last active December 9, 2015 20:08
Getting started with Development on SmartOS

Introduction

The objective of this post is to get people up and running with SmartOS with enough development tools to do some C/C++ and NodeJS development and take advantage of some amazing tools available only on this platform.

In my case the killer app available on SmartOS is DTrace, which enables me to peak inside a running nodejs application and observe various aspects of it's operation.

Install SmartOS

In my case I normally use the VMWare version of dtrace, this can be downloaded from SmartOS Download Page.

Once downloaded this just needs to be copied to your Documents/Virtual Machines folder and launched by double clicking on the file.

@wolfeidau
wolfeidau / gist:4331525
Created December 18, 2012 20:11
Very obvious issue retrieving mac addresses with my node-netif library clearly illustrated by strace.
strace node tools/leaks.js
execve("/usr/local/bin/node", ["node", "tools/leaks.js"], [/* 20 vars */]) = 0
brk(0) = 0x1dd2000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff198b68000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=19450, ...}) = 0
mmap(NULL, 19450, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7ff198b63000
close(3) = 0
@wolfeidau
wolfeidau / gist:4433306
Last active December 10, 2015 12:19
More node-worker-farm dtrace fun.
sudo dtrace -Z -n 'syscall::fork*: /execname == "node"/{ printf("%d %d", timestamp, pid); }' -n 'node-worker-farm*:::startChild{ trace(arg0) }'
dtrace: description 'syscall::fork*: ' matched 2 probes
dtrace: description 'node-worker-farm*:::startChild' matched 0 probes
CPU ID FUNCTION:NAME
0 135 fork:entry 13517852979208 83369
0 136 fork:return 13518351020260 83369
0 12238 startChild:startChild 0
0 135 fork:entry 13518352693874 83369
6 136 fork:return 13518939170250 83369
6 12238 startChild:startChild 1
@wolfeidau
wolfeidau / gist:4480865
Created January 8, 2013 03:16
node-worker-farm tracing all start, stop and onExit of child processes.
trogdor:~ root# dtrace -Z -n 'worker-farm*:::*{ trace(arg0) }'
dtrace: description 'worker-farm*:::*' matched 0 probes
CPU ID FUNCTION:NAME
0 78868 startChild:startChild 0
0 78868 startChild:startChild 1
0 78868 startChild:startChild 3
6 78868 startChild:startChild 2
1 78868 startChild:startChild 4
2 78868 startChild:startChild 5
6 78868 startChild:startChild 6