Skip to content

Instantly share code, notes, and snippets.

View stephank's full-sized avatar

Stéphan Kochen stephank

View GitHub Profile
@stephank
stephank / keybase.md
Created October 18, 2016 13:53
keybase.md

Keybase proof

I hereby claim:

  • I am stephank on github.
  • I am stephank (https://keybase.io/stephank) on keybase.
  • I have a public key ASBiXIU3HeuKIfnkJ6R0-ipuKBQsxn3Udvg7BMyM2e2m0go

To claim this, I am signing this object:

#!/usr/bin/env node
'use strict';
// The master must be reasonably stressed for the crash to appear. These
// parameters can be tweaked to accomplish that. Increasing them too far can
// cause backlog fill and undesirable connection resets.
//
// These particular values seem to work on Ubuntu 15.04 running on an EC2
// c3.large instance with official node.js 4.1.0 binaries. (Everything 64-bit)
var WORKERS = 50;
@stephank
stephank / pub.js
Created May 13, 2014 11:16
Redis pub/sub stress test
#!/usr/bin/env node
var net = require('net');
var host = process.argv[2] || '127.0.0.1';
var port = parseInt(process.argv[3], 10) || 6379;
var len = parseInt(process.argv[4], 10) || 3000;
var msg =
'*3\r\n' +
@stephank
stephank / test-http-upgrade-nagles.js
Created August 22, 2012 14:13
Node pull #3036, test for Nagle's algorithm.
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
@stephank
stephank / gist:3193920
Created July 28, 2012 16:30
server-time client capability specification

server-time client capability specification

Clients indicate support for the extension by requesting a capability server-time as per the [IRC Client Capabilities Extension][caps].

CAP REQ :server-time

After requesting the capability, clients MUST be able to parse an optional timestamp at the start of each message. The message pseudo-BNF, as defined in [RFC 1459, section 2.3.1][rfc1459] is extended to look as follows:

::= ['@' ] [':' ]

@stephank
stephank / include.gypi
Created May 1, 2012 19:30
GYP product_dir with dependencies
{
"target_defaults": {
"product_dir": "products"
}
}
@stephank
stephank / typed-array-copy.js
Created April 12, 2012 20:12
TypedArray#set copy test
// console runnable test case adapted from:
// https://github.com/stephank/node-arrays/blob/master/test/typed-array-copy.js
function assertEq(desc, a, b) { console.log(desc + ": " + a + " == " + b + " ? " + (a == b)); }
a = new Uint16Array(8);
b = new Uint8Array(a.buffer, 0, 2);
b[0] = 0x05;
b[1] = 0x05;
@stephank
stephank / README.md
Created January 18, 2012 15:49
PulseAudio homebrew formula
static int EIO_AfterDrawMap(eio_req *req) {
HandleScope scope;
drawmap_request *drawmap_req =(drawmap_request *)req->data;
ev_unref(EV_DEFAULT_UC);
drawmap_req->map->Unref();
Local<Value> argv[2];
if (drawmap_req->data != NULL) {
Buffer * buffer = Buffer::New(drawmap_req->data, drawmap_req->size, FreeImageBuffer, NULL);
(function () {
var myModule = {
"prop1" : "some value",
"prop2" : "some other value"
};
myModule.someMethod = function () {
// Do stuff with props.
};