This file contains hidden or 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/ruby | |
arch, os = RUBY_PLATFORM.split('-') | |
if os =~ /^darwin/ | |
SYS_poll = 230 # OSX 7 on linux x86_64, 168 on linux i386 | |
# /usr/include/sys/poll.h | |
# Requestable events. If poll(2) finds any of these set, they are | |
# copied to revents on return. | |
POLLIN = 0x0001 |
This file contains hidden or 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/ruby | |
require 'rubygems' | |
require 'eventmachine' | |
$done = false | |
module FdWatcher | |
def notify_readable | |
puts "readable event" | |
begin |
This file contains hidden or 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/ruby | |
require 'rubygems' | |
require 'eventmachine' | |
$done = false | |
module FdWatcher | |
def notify_readable | |
puts "readable event" | |
begin |
This file contains hidden or 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/ruby | |
require 'rubygems' | |
require 'eventmachine' | |
$done = false | |
module FdWatcher | |
def notify_readable | |
puts "readable event" | |
begin |
This file contains hidden or 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/dist/IO/t/io_xs.t b/dist/IO/t/io_xs.t | |
index 968b3f5..9478f00 100644 | |
--- a/dist/IO/t/io_xs.t | |
+++ b/dist/IO/t/io_xs.t | |
@@ -43,7 +43,7 @@ SKIP: | |
{ | |
$^O eq "MSWin32" | |
and skip "directory sync doesn't apply to MSWin32", 1; | |
- open my $dh, "<", "." | |
- or skip "Cannot open the cwd", 1; |
This file contains hidden or 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 'etc' | |
def run_as(user) | |
pw = Etc.getpwnam(user) | |
orig_uid = Process.euid | |
orig_gid = Process.egid | |
orig_groups = Process.groups | |
begin |
This file contains hidden or 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 'etc' | |
module Elvis | |
def Elvis.check_threads | |
if Thread.list.length != 1 | |
raise "Elvis.run_as cannot be used with threads" | |
end | |
end |
This file contains hidden or 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 sorted(enumerable) | |
enumerable.sort do |a, b| | |
if Hash === a && Hash === b | |
if a[:name] && b[:name] | |
a[:name] <=> b[:name] | |
else | |
sorted(a.keys).inspect <=> sorted(b.keys).inspect | |
end | |
elsif Symbol === a && Symbol === b | |
puts "DEBUG: symbol" |
This file contains hidden or 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
$ mssh -r %mycluster -t 10 -c 'uname -r' | |
db0100..0150.example.com,fe1000..1200.example.com: '2.6.32-71.el6.x86_64' | |
db0000..0099.example.com: '2.6.18-274.12.1.el5' | |
db0151.example.com,fw1000..10.vault.example.com: '' |
This file contains hidden or 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 noshell_exec(cmd) | |
if cmd.length == 1 | |
Kernel.exec([cmd[0], cmd[0]]) | |
else | |
Kernel.exec([cmd[0], cmd[0]], *cmd[1..-1]) | |
end | |
end |
OlderNewer