Skip to content

Instantly share code, notes, and snippets.

View davglass's full-sized avatar
💭
Taking a much needed sabbatical from Open Source. Please fork and carry on.

Dav Glass davglass

💭
Taking a much needed sabbatical from Open Source. Please fork and carry on.
View GitHub Profile
@trevnorris
trevnorris / perf-flame-graph-notes.md
Last active December 24, 2023 05:25
Quick steps of how to create a flame graph using perf

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
@tj
tj / some.sh
Created October 11, 2012 18:45
change terminal tab name on cd
function tabname {
printf "\e]1;$1\a"
}
if [ x`type -t cd` == "xfunction" ]; then
# previously wrapped cd
eval $(type cd | grep -v 'cd is a function' | sed 's/^cd/original_cd/' | sed 's/^}/;}/' )
else
# builtin
eval "original_cd() { builtin cd \$*; }"
@rgrove
rgrove / gist:3658306
Created September 6, 2012 16:38
My .jshintrc
{
// enforcing options (true means potentially more warnings)
"bitwise": true, // true if bitwise operators should not be allowed
"curly": true, // true if curly braces should be required around blocks in loops and conditionals
"eqeqeq": true, // true if === should be required (for ALL equality comparisons)
"forin": false, // true if unfiltered 'for in' statements should be forbidden
"immed": true, // true if immediate function invocations must be wrapped in parens
"newcap": true, // true if Initial Caps must be used with constructor functions
"noarg": true, // true if arguments.caller and arguments.callee should be forbidden
@isaacs
isaacs / http-example-client.js
Created December 1, 2010 08:35
a simple example of a nodejs http client making a POST request
var http = require("http")
, util = require("sys") // 0.3.x: require("util")
, fs = require("fs")
, client = http.createClient(80, "example.com")
, request = client.request("POST", "/", {"host":"example.com"})
// send body chunks
request.write("hello, world")
// pump a file through
var temp;
if (typeof YUI != 'undefined') {
temp = YUI;
YUI = undefined;
}
loadJS('bagger-yui', 'http://yui.yahooapis.com/combo?3.1.1/build/yui/yui-min.js', false);
// now wait for YUI to load
var waitForYUIJS = setInterval(function() {