Skip to content

Instantly share code, notes, and snippets.

@eric
eric / app.rb
Created June 10, 2010 01:31
Using Moonshine and Capistrano with multiple roles
# manifests/capistrano_role/app.rb
module CapistranoRole
module App
def app_stack
recipe :memcached
end
end
end
/*
* Bookmarklet for viewing source in iPad Safari
* Originally from http://www.ravelrumba.com/blog/ipad-view-source-bookmarklet/
*/
javascript:(function(){
var w = window.open('about:blank'),
s = w.document;
s.write('<!DOCTYPE html><html><head><title>Source of ' + location.href + '</title><meta name="viewport" content="width=720, maximum-scale=1.0, minimum-scale=1.0, initial-scale=1.0" /></head><body></body></html>');
$ turn exec-testing.rb
Loaded suite
TestCases
test: #{CLIENT} "*?{}[]" PASS
test: #{CLIENT} "something ; echo anything" PASS
test: #{CLIENT} "something with quotes" PASS
test: #{CLIENT} "something | cat" PASS
test: #{CLIENT} $PWD $USER "$HOME $SHELL" PASS
test: #{CLIENT} singlearg PASS
test: #{CLIENT} something * PASS
diff --git a/ext/extconf.rb b/ext/extconf.rb
index 48d052a..e82989e 100644
--- a/ext/extconf.rb
+++ b/ext/extconf.rb
@@ -68,6 +68,10 @@ def check_libmemcached
puts(cmd = "patch -p1 -Z < sasl.patch")
raise "'#{cmd}' failed" unless system(cmd)
+ puts "Touching aclocal.m4 in libmemcached."
+ puts(cmd = "touch -r #{BUNDLE_PATH}/m4/visibility.m4 #{BUNDLE_PATH}/configure.ac #{BUNDLE_PATH}/m4/pandora_have_sasl.m4")
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
@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
@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'
#
<!-- 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 / 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
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(' && ')