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
#!/usr/bin/env bash | |
set -m | |
[ -f post-receive.pid ] && kill `cat post-receive.pid` &>/dev/null | |
echo $$ > post-receive.pid | |
trap 'kill %%; exit 1' EXIT | |
APIKEY=somekey | |
while true | |
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
$pid = fork | |
if $pid == nil | |
exec "./srvd/redis-server ./srvd/redis.conf" | |
end | |
sleep 5 | |
Process.kill(:$pid) |
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
[harry@icecreamtruck (ruby19) maildir]$ bundle exec rake | |
(in /Users/harry/code/maildir) | |
/Users/harry/.rvm/rubies/rbx-1.2.3-20110315/bin/rbx -I"lib:test" "/Users/harry/.rvm/gems/rbx-1.2.3-20110315/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/test_helper.rb" "test/test_keywords.rb" "test/test_maildir.rb" "test/test_message.rb" "test/test_serializers.rb" "test/test_subdirs.rb" "test/test_unique_name.rb" | |
ERROR: the VM is exiting improperly | |
intended operation: :exception | |
associated value: nil | |
===================================== | |
Exception occurred during top-level exception output! (THIS IS BAD) |
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
#!/usr/bin/env bash | |
set -m | |
[ -f post-receive.pid ] && kill `cat post-receive.pid` &>/dev/null | |
echo $$ > post-receive.pid | |
trap 'kill %%; exit 1' EXIT | |
while true | |
do | |
echo "Waiting for request." | |
echo -ne "HTTP/1.1 200 OK\r\nContent-Length: 2\r\n\r\nOK" \ |
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 path matcher | |
lambda {|req| | |
return unless match = req.env["PATH_INFO"].match(/^\/(#{matcher})(\/|$)/) | |
path = match.captures[0] | |
req.env["SCRIPT_NAME"] += "/#{path}" | |
req.env["PATH_INFO"] = "/#{match.post_match}" | |
} | |
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
require "ircator" | |
irc = Ircator::Connection.new( | |
:nick => "ircator", | |
:host => "irc.ircator.com", | |
:port => 6667, | |
:password => "secret" | |
) | |
irc.transmit "JOIN #channel" |
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
require "sinatra" | |
use Rack::Session::Cookie | |
get "/" do | |
session["counter"] ||= 0 | |
session["counter"] += 1 | |
"count: #{session["counter"]}" | |
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
require "curb" | |
# Persistent. | |
c = Curl::Easy.new | |
c.url = "http://127.0.0.1" | |
2.times { c.perform } | |
# Not persistent. | |
2.times { | |
c = Curl::Easy.new |
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/lib/mock_server.rb b/lib/mock_server.rb | |
index d09a2b4..99c4089 100644 | |
--- a/lib/mock_server.rb | |
+++ b/lib/mock_server.rb | |
@@ -6,11 +6,9 @@ class MockServer | |
use Rack::ShowExceptions | |
end | |
- def initialize(port = 4000, &block) | |
+ def initialize(app, port = 4000, &block) |
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
$ ruby thread-rmagick.rb ruby-1.9.2-p0 | |
thread-rmagick.rb:4: [BUG] Segmentation fault | |
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0] | |
-- control frame ---------- | |
c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC :read | |
c:0003 p:0019 s:0007 b:0007 l:001598 d:000006 BLOCK thread-rmagick.rb:4 | |
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH | |
c:0001 p:---- s:0002 b:0002 l:000001 d:000001 TOP | |
--------------------------- |