Skip to content

Instantly share code, notes, and snippets.

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")
$ 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
/*
* 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>');
@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
@eric
eric / capistrano_roles.rb
Created June 10, 2010 05:13
Add support to capistrano for $CAPISTRANO:ROLES$
::Capistrano::Command.class_eval do
def replace_placeholders(command, channel)
command = command.dup
command.gsub!(/\$CAPISTRANO:HOST\$/, channel[:host])
command.gsub!(/\$CAPISTRANO:ROLES\$/, channel[:server].roles.join(','))
command
end
end
::Capistrano::ServerDefinition.class_eval do
class ApplicationManifest < Moonshine::Manifest
def ntp
package 'ntp', :ensure => :latest
case Facter.lsbdistid
when 'Ubuntu'
service 'ntp', :alias => 'ntp', :ensure => :running,
:require => package('ntp'), :pattern => 'ntpd'
when 'Fedora', 'RedHat'
service 'ntpd', :alias => 'ntp', :ensure => :running,
def Facter.case(name, whens)
if whens[:default].is_a?(Exception)
default = proc { raise whens[:default] }
elsif whens[:default].is_a?(Proc)
default = whens[:default]
elsif whens[:default]
default = proc { whens[:default] }
else
default = proc { |value| raise "Unsupported case for '#{name}': #{value}" }
end
# estimate the duration of an ALTER TABLE statement in mysql
# this code estimates the worst case, as most of the time, an ALTER will result in a table that is smaller than the original
percentage = 0
interval = 10
while(true) do
sleep(interval)
new_percentage = (File.size('#sql-5316_1a.ibd').to_f / File.size('moves.ibd').to_f)
change = new_percentage - percentage
intervals = 1.0/change
# A mechanism for shadow_puppet to install source packages
module Moonshine
module SourcePackage
def source_package(name, options = {})
build_root = options[:build_root] || '/usr/src'
dist_root = options[:dist_root] || File.join(build_root, 'dist')
url = options[:url]
filename = options[:filename] || File.basename(url)
expanded_directory = options[:expanded_directory] || filename[/^(.+)\.(tar|tgz|tbz)/, 1]
expanded_root = options[:expanded_root] || File.join(build_root, expanded_directory)
exec { 'first':
command => '/usr/bin/true',
unless => '/bin/test -f ./mark.txt'
}
exec { 'second':
command => '/usr/bin/false',
subscribe => Exec['first'],
refreshonly => true
}