Skip to content

Instantly share code, notes, and snippets.

View tobytripp's full-sized avatar

Toby Tripp tobytripp

View GitHub Profile
db.serverStatus(); // On a mongod that is unresponsive to queries
{
"uptime" : 13956,
"localTime" : "Fri May 28 2010 09:42:57 GMT-0400 (EDT)",
"globalLock" : {
"totalTime" : 13955605883,
"lockTime" : 1910430,
"ratio" : 0.00013689337575283544
},
"mem" : {
@tobytripp
tobytripp / gist:417572
Created May 28, 2010 18:59
mongod has expanded to fill 124G of available RAM and become unresponsive.
db.serverStatus(); // On a mongod that is unresponsive to queries
{
"uptime" : 13956,
"localTime" : "Fri May 28 2010 09:42:57 GMT-0400 (EDT)",
"globalLock" : {
"totalTime" : 13955605883,
"lockTime" : 1910430,
"ratio" : 0.00013689337575283544
},
"mem" : {
@tobytripp
tobytripp / gist:417615
Created May 28, 2010 19:30
iostat during unresponsive mongod
avg-cpu: %user %nice %system %iowait %steal %idle
0.03 0.00 0.03 12.43 0.00 87.51
Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util
sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sda1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sda2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sdb 500.00 0.00 419.00 0.50 12928.00 4.00 30.83 2.12 5.04 2.38 100.05
sdb1 500.00 0.00 419.00 0.50 12928.00 4.00 30.83 2.12 5.04 2.38 100.05
dm-0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
total used free shared buffers cached
Mem: 128992 128681 311 0 89 127541
-/+ buffers/cache: 1050 127941
Swap: 2047 265 1782
db.people.getIndexes()
[
{
"name" : "_id_",
"ns" : "dnc_voters.people",
"key" : {
"_id" : 1
}
},
{
#!/usr/bin/env ruby
require "rubygems"
require "faker"
require "csv"
line_count = ARGV.empty? ? 55 : ARGV.first.to_i
def maybe( value, percent_chance )
return "" unless rand * 100 < percent_chance
@tobytripp
tobytripp / PeepOpen sample
Created August 25, 2010 19:29
Sample of a running PeepOpen process that is stuck reloading the project directory
Sampling process 67060 for 3 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling PeepOpen (pid 67060) every 1 millisecond
Call graph:
2652 Thread_1397568 DispatchQueue_1: com.apple.main-thread (serial)
2652 start
2652 macruby_main
2652 ruby_run_node
2652 rb_vm_run
2652 0x1014009f4
@tobytripp
tobytripp / audio_test.rb
Created April 18, 2011 13:28
Play a given audio file in Ruby
#!/usr/bin/env ruby
require 'rubygame'
include Rubygame
# Stuff that I had to do to get this running:
#
# brew install sdl sdl_mixer
# gem install rubygame rsdl
# Let's start by trying to play a random mp3 passed as an argument
@tobytripp
tobytripp / unicode_update.rb
Created January 12, 2012 15:08
Ruby OCI, you make me sad…
#!/usr/bin/env ruby
ENV['NLS_LANG'] = 'AMERICAN_AMERICA.UTF8'
require 'oci8'
def exec( connection, sql )
puts "exec: #{sql}"
connection.exec( sql ) { |r| puts r.join(', ') }
end
def main
ruby-1.9.3-p125@gset:
system:
uname: "Darwin Tobys-Air.local 11.3.0 Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64"
bash: "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)"
zsh: "/bin/zsh => zsh 4.3.11 (i386-apple-darwin11.0)"
rvm:
version: "rvm 1.10.3 by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.beginrescueend.com/]"
updated: "20 minutes 46 seconds ago"