Skip to content

Instantly share code, notes, and snippets.

Mark Cavage mcavage

Block or report user

Report or block mcavage

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ryan_cors.js
var bunyan = require('bunyan');
var restify = require('restify');
var server = restify.createServer({
log: bunyan.createLogger({
name: 'restify',
stream: process.stdout,
level: process.env.LOG_LEVEL || 'info',
serializers: restify.bunyan.serializers
})
@mcavage
mcavage / gist:3309350
Created Aug 10, 2012
telling me where to look further at what my restify app is doing...
View gist:3309350
putobject-ensureParent
value ------------- Distribution ------------- count
-1 | 0
0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 153
1 | 1
2 | 1
4 | 1
8 | 0
putobject-ensureContentLength
@mcavage
mcavage / gist:1856186
Created Feb 17, 2012
stopmachine.sh
View gist:1856186
#!/bin/bash
# Globals
#export SDC_CLI_URL=https://us-west-1.api.joyentcloud.com
#export SDC_CLI_ACCOUNT=mark.cavage
#export SDC_CLI_KEY_ID=id_rsa
View jerry_basic_auth.js
var restify = require('restify');
///--- Globals
var NotAuthorizedError = restify.NotAuthorizedError;
View file_and_line.js
/**
* Figure out how long it takes for a method to execute.
*
* @param {func} method to test
* @param {int} iterations number of executions.
* @param {Array} args to pass in.
* @param {T} context the context to call the method in.
* @return {int} the time it took, in milliseconds to execute.
*/
var bench = function (method, iterations, args, context) {
@mcavage
mcavage / gist:1712462
Created Jan 31, 2012
Argument checking simplification
View gist:1712462
if (!String.prototype.capitalize) {
String.prototype.capitalize = function() {
return this.charAt(0).toUpperCase() + this.slice(1);
}
}
function assertArg(name, type) {
if (typeof(name) !== type)
throw new TypeError(name + '(' + type.capitalize() + ') required');
View gist:1563151
#!/usr/bin/env node
// -*- mode: js -*-
var fs = require('fs');
var semver = require('semver');
var spawn = require('child_process').spawn;
///--- Globals
var deps = {};
View gist:1445793
[root@headnode (bh1-kvm1:0) ~]# plockstat -A -e 6 -p 40679
0
Mutex hold
Count nsec Lock Caller
-------------------------------------------------------------------------------
8421 1751 0xaa5408 beam.smp`erts_smp_mtx_unlock+0x9
2629 1749 0x61dee0 beam.smp`erts_deliver_time+0x4b
3257 1395 0xed46e8 beam.smp`erts_alcu_alloc_thr_pref+0xd6
208 21752 0xfffffd7fe97d9a70 beam.smp`do_port_command+0x34c
View gist:1445737
[root@headnode (bh1-kvm1:0) ~]# dtrace -n 'profile-997 /execname == "beam.smp"/ { @[stack()] = count(); }'
dtrace: description 'profile-997 ' matched 1 probe
^C
genunix`writev+0x248
unix`sys_syscall+0x17a
1
genunix`syscall_mstate+0x91
View gist:1444883
[root@headnode (coal:0) ~]# dtrace -n 'syscall:::entry /execname == "beam.smp"/ { self->s = timestamp; } syscall:::return /self->s/ { @[>
dtrace: description 'syscall:::entry ' matched 462 probes
^C
beam.smp mmap
value ------------- Distribution ------------- count
8192 | 0
16384 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2
32768 | 0
You can’t perform that action at this time.