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
cat production.log | ruby -rtime -n \ | |
-e 'ts = $_.scan(/at (\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})/)' \ | |
-e 'last_ts = ts if ts.size > 0' \ | |
-e 'm = $_.scan(/DB: (\d+)/)' \ | |
-e 'puts "#{Time.parse(last_ts.to_s).to_i} #{m[0]}" if m.size > 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
# | |
#### output: | |
# | |
# Called in [MixinA] | |
# Called in [MixinC] | |
# Called in [MixinB] | |
# Called in [Klass] | |
# Called in [MixinD] | |
# Called in [SubKlass] | |
# |
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
--- | |
--- Make sure you run mysqlcheck -Aa on your database before running this, or | |
--- that you are reasonably certain your statistics are up to date. | |
--- | |
SELECT | |
stats.table_schema, | |
stats.table_name, | |
stats.index_name, | |
GROUP_CONCAT(stats.column_name) AS column_names, |
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
cat production.log | grep "Completed in" | sed -e 's/.* \([0-9]*\)ms .*\[http.*:\/\/[^/]*\([^\?0-9]*\).*\].*/\1 \2/' |
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
// | |
// cruncher-reducer.c | |
// | |
// $ cc -o cruncher-reducer cruncher-reducer.c | |
// | |
// NOTE: Run data through "sort" first or it won't work. If your keys don't have any | |
// spaces, it's just something like this to get a proper numeric sort: | |
// | |
// $ cat input | sort -k1,2n | cruncher-reducer | |
// |
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
# | |
# On OS X 10.6.7: | |
# | |
# JRuby 1.6.0: | |
# | |
# $ time jruby --server puts-lines.rb 10000000 > /dev/null | |
# | |
# real 0m52.309s | |
# user 0m32.801s | |
# sys 0m16.642s |
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
def ranges_of_calendar_units_in_range(what, range) | |
b_sym, e_sym = "beginning_of_#{what}".to_sym, "end_of_#{what}".to_sym | |
range.map { |d| d.send(b_sym) .. d.send(e_sym) }.uniq | |
end |
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
# | |
# Drop this little gem in your spec/support/helpers | |
# | |
########################################################### | |
# | |
# context "things" do | |
# let(:item) { mock_model(Item) } | |
# action { put :update, :item => item } | |
# |
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
# | |
# | |
# God of Gods - A god config file | |
# Rick Branson <rick@diodeware.com> | |
# | |
# Runs a god instance for every user on the system, provided | |
# they have a .godrc file in their home diretory, which is just | |
# a regular old god config file. | |
# | |
# |
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
slower:elasticsearch-0.16.2 rbranson$ lsof -p 17392 | grep lib | |
ruby 17392 rbranson txt REG 14,2 137368 28211204 /opt/local/lib/libtcmalloc_minimal.0.dylib | |
ruby 17392 rbranson txt REG 14,2 8528 28284248 /Users/rbranson/.rvm/rubies/ree-1.8.7-2011.03/lib/libsystem_allocator.dylib | |
ruby 17392 rbranson txt REG 14,2 17176 28283848 /Users/rbranson/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/i686-darwin10.7.0/etc.bundle | |
ruby 17392 rbranson txt REG 14,2 30640 28283863 /Users/rbranson/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/i686-darwin10.7.0/stringio.bundle | |
ruby 17392 rbranson txt REG 14,2 8960 28283859 /Users/rbranson/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/i686-darwin10.7.0/rational.bundle | |
ruby 17392 rbranson txt REG 14,2 9592 28283841 /Users/rbranson/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/i686-darwin10.7.0/digest/sha1.bundle | |
ruby 17392 rbranson txt REG 14,2 19640 28283843 /Users/rbranson/. |