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

Introduction

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

$ node test.js
d2 error
/Users/JulienGilli/dev/node/node/test/addons/make-callback-recurse/test.js:88
    throw new Error('test d1');
@ofrobots
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/node.cc, 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/node.cc:2028
@trevnorris
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
domenic / v8-versions.md
Last active May 7, 2018
V8 versions for embedders
View v8-versions.md

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 https://omahaproxy.appspot.com/
  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.
View node-event-loop.md

Notes:

  • 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
trevnorris / perf-flame-graph-notes.md
Last active Oct 7, 2019
Quick steps of how to create a flame graph using perf
View perf-flame-graph-notes.md

The prep-script.sh 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 http://unix.stackexchange.com/questions/14227/do-i-need-root-admin-permissions-to-run-userspace-perf-tool-perf-events-ar )
sudo sysctl kernel.perf_event_paranoid=0
@maxogden
maxogden / readme.md
Last active Aug 8, 2016
simple 4mb buffer proxy benchmarks
View readme.md

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 https://github.com/substack/bouncy/tree/master/bench

View maybe-bad-stream.js
var net = require('net');
var Readable = require('stream').Readable;
var util = require('util');
function RandomStream() {
Readable.call(this);
}
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:

tmux

start new with session name:

You can’t perform that action at this time.