This file contains 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
# install git | |
sudo apt-get install g++ curl libssl-dev apache2-utils | |
sudo apt-get install git-core | |
# download the Node source, compile and install it | |
git clone https://github.com/joyent/node.git | |
cd node | |
./configure | |
make | |
sudo make install | |
# install the Node package manager for later use |
This file contains 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
# Display current git branch, nicely colored, in the prompt (with a * if there are changes) | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" | |
} | |
export PS1='\u:\[\033[31;40m\]\w\[\033[0;33m\]$(parse_git_branch)\[\e[0m\]$ ' | |
export EDITOR='mate -w' |
This file contains 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
$ bex rails benchmarker 1000 "Artwork.where(:_id.in => [<...100 doc ids...>]).map(&:title)" "[<...100 doc ids...>].map{|id| Artwork.find(id) }.map(&:title)" | |
user system total real | |
#1 112.410000 1.470000 113.880000 (116.483996) | |
#2 151.740000 4.310000 156.050000 (166.557997) |
This file contains 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
[cache] | |
LOCAL_DATA_DIR = /opt/graphite/storage/whisper/ | |
# Specify the user to drop privileges to | |
# If this is blank carbon runs as the user that invokes it | |
# This user must have write access to the local data directory | |
USER = www-data | |
# Limit the size of the cache to avoid swapping or becoming CPU bound. | |
# Sorts and serving cache queries gets more expensive as the cache grows. |
This file contains 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 ruby | |
require 'rubygems' | |
gem 'term-ansicolor', '=1.0.3' | |
require 'term/ansicolor' | |
class GitCommit | |
attr_reader :content | |
This file contains 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
[ | |
[1913,1,9.8], | |
[1913,2,9.8], | |
[1913,3,9.8], | |
[1913,4,9.8], | |
[1913,5,9.7], | |
[1913,6,9.8], | |
[1913,7,9.9], | |
[1913,8,9.9], | |
[1913,9,10.0], |
This file contains 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
require 'rubygems' | |
require 'sinatra' | |
require 'json' | |
get '/latest' do | |
# This is where the [ugly] magic happens. Grep an appropriate path from the _end_ of the incoming log file, | |
# excluding office IP range and paying special attention to escaping... | |
line = `tac /var/log/heroku.log | grep ".*GET [^\?]*/home\/[^/ \\"]*" | grep -v "controls\\|pending\\|99\\.99\\." -m 1` | |
if match = line.match(/\/home\/([a-z0-9\-]*)/i) | |
return match[1].to_json |
This file contains 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 ruby | |
# Set the CHECK_RAILTIE environment variable to star (*) gems without Railties (warning: SLOW). | |
require 'benchmark' | |
REGEXPS = [ | |
/^no such file to load -- (.+)$/i, | |
/^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i, | |
/^Missing API definition file in (.+)$/i, |
This file contains 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 ruby | |
# Set the CHECK_RAILTIE environment variable to star (*) gems without Railties (warning: SLOW). | |
require 'bundler' | |
require 'benchmark' | |
REGEXPS = [ | |
/^no such file to load -- (.+)$/i, | |
/^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i, |
This file contains 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 ruby | |
# I don't remember where I found this, but all credit goes to them. | |
require 'rubygems' | |
gem 'term-ansicolor', '=1.0.3' | |
require 'term/ansicolor' | |
class GitCommit | |
attr_reader :content |