This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bench "paths", :without_gc => true, :gc_time => true do | |
PATHS[0, 1000].each { |choice| Score.score(choice, "x" * 16) } | |
end | |
Output: | |
...!.!.!.!.............................................. | |
filtering paths | |
Before: | --X----------------------- | | |
After: | ---------X-------------------------| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This tool is used to compare microbenchmarks across two versions of code. It's | |
paranoid about nulling out timing error, so the numbers should be meaningful. | |
It runs the benchmarks many times, scaling the iterations up if the benchmark | |
is extremely short, and it nulls out its own timing overhead while doing so. It | |
reports results graphically with a text interface in the terminal. | |
You first run it with --record, which generates a JSON dotfile with runtimes | |
for each of your benchmarks. Then you change the code and run again with | |
--compare, which re-runs and generates comparison plots between your recorded | |
and current times. In the example output, I did a --record on the master |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
main() { | |
if [ ! -p .test-commands ]; then | |
mkfifo .test-commands | |
fi | |
while true; do | |
cmd=$(cat .test-commands) | |
if [[ $cmd == "" ]]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
failbowl:rubies(master) $ git l | |
* 65cc7ef (41 seconds) <Gary Bernhardt> (HEAD, master) Merge branch 'activate_command_cleanup' | |
|\ | |
| * f4ced72 (2 minutes) <Gary Bernhardt> extract variables | |
| * f2760be (3 minutes) <Gary Bernhardt> File.join instead of string interpolation | |
| * 94b8df5 (5 minutes) <Gary Bernhardt> activate command's imperative part is in activate! | |
|/ | |
* 9291243 (7 minutes) <Gary Bernhardt> Merge branch 'ruby_info_cleanup' | |
|\ | |
| * b7cb944 (9 minutes) <Gary Bernhardt> indentation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "export #{vars.map { |k, v| %{#{k}="#{v}"} }.join(" ")}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Goal: put a non-Rails-aware Ruby library using normal `require`s in | |
# lib/sim. Have it transparently reloaded between requests like Rails app | |
# code is. | |
# | |
# The code here goes inside of your configure block in | |
# config/environments/development.rb. There are two parts, commented inline. | |
# Reload code whenever the simulator changes. | |
config.watchable_dirs["lib/sim"] = [:rb] | |
config.watchable_files << "lib/sim.rb" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
failbowl:~(master) $ cabal list --installed hunit | |
* HUnit | |
Synopsis: A unit testing framework for Haskell | |
Default available version: 1.2.5.2 | |
Installed versions: 1.2.5.2 | |
Homepage: http://hunit.sourceforge.net/ | |
License: BSD3 | |
failbowl:~(master) $ echo 'import HUnit' | runhaskell |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inbox_blobs() { | |
git ls-tree -r master | grep 'INBOX' | awk '{print $3}' | sort | |
} | |
diff <(cd ../Gmail && inbox_blobs) <(inbox_blobs) | grep '<\|>' | while read marker hash; do | |
echo "$marker $(git show $hash | grep -m 1 '^Subject:')" | |
done | sort |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
/usr/bin/env ruby --disable-gems <(cat <<'EOF' | |
puts "ruby code goes here" | |
EOF) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ echo '#!/bin/ls /' > foo | |
$ ./foo | |
./foo | |
/: | |
bin boot dev etc home initrd.img lib lib64 lost+found media mnt opt proc root run sbin selinux srv sys tmp usr var vmlinuz | |
$ echo '#!/bin/ls / /' > foo | |
$ ./foo | |
/bin/ls: cannot access / /: No such file or directory |