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 'rbtree' | |
class Nano | |
class Pivot | |
def initialize(ary) | |
@ary = ary | |
end | |
end | |
class Prefix < Pivot |
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/local/bin/ruby | |
require 'drb/drb' | |
DRb.start_service | |
ro = DRbObject.new_with_uri('druby://localhost:54321?cgi') | |
ro.start(ENV.to_hash, $stdin, $stdout) |
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 Sbb | |
Node = Struct.new(:key, :value, :lh, :rh, :left, :right) | |
class Search | |
def initialize(key) | |
@key = key | |
@found = nil | |
@created = false | |
end | |
attr_accessor :found, :created |
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 'rinda/tuplespace' | |
require 'singleton' | |
class NotificationCenter | |
include Singleton | |
class Handle | |
def initialize; @removed = false; end | |
def remove; @removed = true; end | |
def removed?; @removed; 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 'drb/drb' | |
ro = DRbObject.new_with_uri(ARGV.shift) | |
name = 'your_nick' | |
url = 'http://your_page' | |
desc = 'your comment' | |
p ro.exchange(name, url, desc) |
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 'thread' | |
require 'drb/drb' | |
require 'rinda/rinda' | |
class Agent | |
def initialize(name, url, desc) | |
@tuple = [name, url, desc] | |
@inbox = Queue.new | |
@renewer = Rinda::SimpleRenewer.new(15) | |
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
#tweet | |
$ irb | |
irb(main):001:0> require 'drb/drb' | |
=> true | |
irb(main):002:0> DRb.start_service | |
=> #<DRb::DRbServer:...> | |
irb(main):003:0> ro = DRbObject.new_with_uri('druby://localhost:54321') | |
=> #<DRb::DRbObject:0...> | |
irb(main):004:0> ro.notify('tweet') |
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 'drb/drb' | |
DRb.start_service | |
ro = DRbObject.new_with_uri('druby://localhost:54000') | |
ro.hello |
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
#terminal 1 | |
duo:~ mas$ irb | |
irb(main):001:0> require 'drb/drb' | |
=> true | |
irb(main):002:0> DRb.start_service | |
ro => #<DRb::DRbServer:0... | |
irb(main):003:0> ro = DRbObject.new_with_uri('druby://localhost:54300') | |
=> #<DRb::DRbObject... | |
irb(main):004:0> ro[1] = 'Hello, World.' |
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 'drb/drb' | |
DRb.start_service | |
queue = DRbObject.new_with_uri('druby://localhost:54320') | |
while true | |
p queue.pop | |
sleep(rand) | |
end |
OlderNewer