Skip to content

Instantly share code, notes, and snippets.

@eric
eric / gist:265204
Created December 29, 2009 07:50
The important changes that fixed the memory leaks in god
diff --git a/lib/god.rb b/lib/god.rb
index 388179a..df39592 100644
--- a/lib/god.rb
+++ b/lib/god.rb
@@ -534,6 +531,9 @@ module God
watches = self.pending_watches.dup
self.pending_watches.clear
self.pending_watch_states.clear
+
+ # make sure we quit capturing when we're done
@eric
eric / .gitconfig
Created January 11, 2010 22:14 — forked from kneath/._what.md
[alias]
up = !sh -c 'git pull && git --no-pager log --pretty=format:\"%Cred%ae %Creset- %C(yellow)%s %Creset(%ar)\" HEAD@{1}.. && echo'
namespace :test do
task :populate_testopts do
if ENV['TESTNAME'].present?
ENV['TESTOPTS'] = ENV['TESTOPTS'] ? "#{ENV['TESTOPTS']} " : ''
ENV['TESTOPTS'] += "--name=#{ENV['TESTNAME'].inspect}"
end
end
end
%w(test:units test:functionals test:integration).each do |task_name|
[2 : 0] eric@morizo:/Users/eric > cat > 'this is a test.sh'
#!/bin/sh
echo "we are so cool"
[3 : 0] eric@morizo:/Users/eric > chmod 755 'this is a test.sh'
[4 : 0] eric@morizo:/Users/eric > irb
>> system "this is a test.sh"
=> false
>> system ["this is a test.sh", "this is a test.sh"]
we are so cool
namespace :bundler do
task :symlink_vendor do
shared_gems = File.join(shared_path, 'vendor/bundler_gems/ruby/1.8')
release_gems = File.join(release_path, 'vendor/bundler_gems/ruby/1.8')
cmd = %w(gems specifications).collect do |sub_dir|
shared_sub_dir = File.join(shared_gems, sub_dir)
"mkdir -p #{shared_sub_dir} && mkdir -p #{release_gems} && ln -s #{shared_sub_dir} #{release_gems}/#{sub_dir}"
end.join(' && ')
@eric
eric / linux-meminfo.rb
Created April 8, 2010 02:19
Gather more useful memory statistics for SNMP
#!/usr/bin/env ruby
#
# linux-meminfo
#
# by Eric Lindvall <[email protected]>
#
# Gather more useful memory statistics for SNMP
#
# To see the example output, run:
# linux-meminfo.rb -g .1.3.6.1.4.1.2021.4.6.0
<!-- You'll need this in your <head> somewhere -->
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
google.load("gdata", "1.x", { packages : ["calendar"] });
</script>
@eric
eric / agi_handler.rb
Created April 20, 2010 01:12
Simple TCP server that can be used as an AGI server for PHP
#!/usr/bin/env ruby
#
# A simple tool to run php-based AGIs
#
# by Eric Lindvall <[email protected]>
#
# Usage: agi_handler.rb 4755 'php php_agi.php'
#
@eric
eric / ports.sh
Created April 21, 2010 18:40 — forked from defunkt/ports.sh
# List what ports are in use on OS X
sudo lsof -iTCP -sTCP:LISTEN
CRYPT [132 : 0] eric@alien:/home/eric > sudo gem install memcached
Building native extensions. This could take a while...
ERROR: Error installing memcached:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
Building libmemcached.
tar xzf libmemcached-0.32.tar.gz 2>&1
Patching libmemcached source.
patch -p1 -Z < libmemcached.patch