Skip to content

Instantly share code, notes, and snippets.

View Fishrock123's full-sized avatar
💭
#freepalestine #blacklivesmatter #acab drop ICE you cowards

Jeremiah Senkpiel Fishrock123

💭
#freepalestine #blacklivesmatter #acab drop ICE you cowards
View GitHub Profile

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):

# expose kernel pointers to perf
# because of /proc/kallsyms; with kernel.kpt_restrict=1, the symbol addresses are hidden
sudo sysctl kernel/kptr_restrict=0

perf record -i -g -e cycles:u -- ~/sources/node/node --perf-basic-prof script.js
@Fishrock123
Fishrock123 / genrun.js
Last active December 18, 2015 05:38 — forked from jlongster/testgen.js
basic generator async lib fleshed out to be slightly nicer
// based off of https://gist.github.com/creationix/5544019
// these could probably be condensed more, but I'm just doing this
// quickly
exports = module.exports = run;
exports.call = call;
exports.invoke = invoke;
exports.bind = bind;
class Point
constructor: (@x = 0, @y = 0) ->
if isNaN(@x) or isNaN(@y)
throw new Error('Invalid coords')
add: (point) ->
@x += point.x
@y += point.y
subtract: (point) ->
/**
* Overwrites default Mousetrap.bind method to optionally accept
* an object to bind multiple key events in a single call
*
* You can pass it in like:
*
* Mousetrap.bind({
* 'a': function() { console.log('a'); },
* 'b': function() { console.log('b'); }
* });