Skip to content

Instantly share code, notes, and snippets.

Stéphan Kochen stephank

View GitHub Profile
View 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:

View node-issue-2928.js
#!/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
Redis pub/sub stress test
View pub.js
#!/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 Aug 22, 2012
Node pull #3036, test for Nagle's algorithm.
View test-http-upgrade-nagles.js
// 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 Jul 28, 2012
server-time client capability specification
View gist:3193920

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:

<message>    ::= ['@' <line-props> <SPACE>] [':' <prefix> <SPACE> ] <command> <params> <crlf>
@stephank
stephank / include.gypi
Created May 1, 2012
GYP product_dir with dependencies
View include.gypi
{
"target_defaults": {
"product_dir": "products"
}
}
@stephank
stephank / typed-array-copy.js
Created Apr 12, 2012
TypedArray#set copy test
View typed-array-copy.js
// 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 Jan 18, 2012
PulseAudio homebrew formula
View README.md

A Homebrew formula for installing PulseAudio on OS X.

Tested on Lion, and at the moment requires the 10.7 SDK.

Installation

brew install https://raw.github.com/gist/1633642/pulseaudio.rb
View gist:710033
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);
View module-pattern-example2.js
(function () {
var myModule = {
"prop1" : "some value",
"prop2" : "some other value"
};
myModule.someMethod = function () {
// Do stuff with props.
};
You can’t perform that action at this time.