Skip to content

Instantly share code, notes, and snippets.

Trevor Norris trevnorris

Block or report user

Report or block trevnorris

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 gist:fac76caa775b3ad63ac8


This is a short write-up that explains why test/addons/make-callback-recurse/test.js in fails with the following error message:

$ node test.js
d2 error
    throw new Error('test d1');
ofrobots / gist:0bdcab89771221ace68d
Last active May 24, 2019
Using V8's gdb macros for low level debugging
View gist:0bdcab89771221ace68d
$ gdb --args ./iojs_g -pe 'process.hrtime([0,0])'
(gdb) source deps/v8/tools/gdbinit
(gdb) b node::Hrtime
Breakpoint 1 at 0x1282619: file ../src/, line 2028.
(gdb) r
Starting program: /usr/local/google/home/ofrobots/src/io.js/iojs_g -pe process.hrtime\(\[0,0\]\)
Breakpoint 1, node::Hrtime (args=...) at ../src/
trevnorris / .eslintrc
Last active Aug 29, 2015
My .eslintrc of choice. Still have a few things to work out.
View .eslintrc
'ecmaFeatures': {
'binaryLiterals': true,
'blockBindings': true,
'forOf': true,
'generators': true,
'octalLiterals': true,
'templateStrings': true,
'env': {
domenic /
Last active May 7, 2018
V8 versions for embedders

Embedders of V8 should generally use the head of the branch corresponding to the minor version of V8 that ships in Chrome.

Finding the minor version of V8 corresponding to the latest stable Chrome

To find out what version this is,

  1. Go to
  2. Find the latest stable Chrome version in the table
  3. Enter it into the "Translate a Chrome verison to a V8 version" box below the table.
  4. Ignore the last two parts.


  • Text in [[ ]] are the internal libuv function call.
  • Text in {{ }} are the Node functions that are affected.
  • Text in ( ) are notes about what is happening.
  • While the Windows event loop has minor variations, I don't believe any of those affect Node.

On process.nextTick():

trevnorris /
Last active Oct 7, 2019
Quick steps of how to create a flame graph using perf

The will setup the latest Node and install the latest perf version on your Linux box.

When you want to generate the flame graph, run the following (folder locations taken from install script):

sudo sysctl kernel.kptr_restrict=0
# May also have to do the following:
# (additional reading )
sudo sysctl kernel.perf_event_paranoid=0
maxogden /
Last active Aug 8, 2016
simple 4mb buffer proxy benchmarks

simple 4mb buffer proxy benchmarks

the goal: to do fast virtual host routing, e.g. to have a single process on a machine listening on port 80 and proxying data based on HTTP Host to other non-port-80 web processes on the same machine

many people use nginx for this because nginx is faster than node is currently for data-heavy applications (see below)

about these benchmarks

they use the JS proxies from

View maybe-bad-stream.js
var net = require('net');
var Readable = require('stream').Readable;
var util = require('util');
function RandomStream() {;
util.inherits(RandomStream, Readable);
var cntr = 10;
View really-crapy-multi-write.js
// Something horrible happens and this maxes out at ~800 req/sec.
var TCP = process.binding('tcp_wrap').TCP;
var SlowBuffer = require('buffer').SlowBuffer;
var util = require('util');
var cntr = 0;
var err;
var headers = 'HTTP/1.1 200 OK\r\n' +
'Server: TCPTest\r\n' +
View tmux_cheatsheet.markdown

tmux cheatsheet

As configured in my dotfiles.

start new:


start new with session name:

You can’t perform that action at this time.