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
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") |
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
$ 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 |
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
/* | |
* 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>'); |
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
# manifests/capistrano_role/app.rb | |
module CapistranoRole | |
module App | |
def app_stack | |
recipe :memcached | |
end | |
end | |
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
::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 |
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
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, |
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 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 |
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
# 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 |
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
# 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) |
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
exec { 'first': | |
command => '/usr/bin/true', | |
unless => '/bin/test -f ./mark.txt' | |
} | |
exec { 'second': | |
command => '/usr/bin/false', | |
subscribe => Exec['first'], | |
refreshonly => true | |
} |