Skip to content

Instantly share code, notes, and snippets.

View Albert-IV's full-sized avatar

Albert Engelbrecht Albert-IV

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
@shesek
shesek / dcoffee
Created April 24, 2012 21:15
Bash script for quickly debugging CoffeeScript line numbers
#!/bin/bash
[ -z $3 ] && AROUND=2 || AROUND=$3
coffee -cp $1 | nl -b a | perl -pe "\$_ = \"\033[1;29m\$_\033[0m\" if (\$. == $2)" | head -n $(($2+$AROUND)) | tail -n $(($AROUND * 2 + 1))
# Usage: dcoffee path/to/file.coffee <LINE NUMBER> [NUMBER OF LINES BEFORE/AFTER]
# A tiny bash script for finding a line in the compiled JavaScript with some context around it,
# useful to quickly check where errors in compiled JavaScript are coming from.
# https://github.com/jashkenas/coffee-script/issues/558 FTW