Skip to content

Instantly share code, notes, and snippets.

#!/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
#!/usr/bin/ruby
require 'rubygems'
require 'eventmachine'
$done = false
module FdWatcher
def notify_readable
puts "readable event"
begin
#!/usr/bin/ruby
require 'rubygems'
require 'eventmachine'
$done = false
module FdWatcher
def notify_readable
puts "readable event"
begin
#!/usr/bin/ruby
require 'rubygems'
require 'eventmachine'
$done = false
module FdWatcher
def notify_readable
puts "readable event"
begin
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;
require 'etc'
def run_as(user)
pw = Etc.getpwnam(user)
orig_uid = Process.euid
orig_gid = Process.egid
orig_groups = Process.groups
begin
require 'etc'
module Elvis
def Elvis.check_threads
if Thread.list.length != 1
raise "Elvis.run_as cannot be used with threads"
end
end
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"
$ 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: ''
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