Skip to content

Instantly share code, notes, and snippets.

Masatoshi SEKI seki

Block or report user

Report or block seki

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@seki
seki / gist:118701
Created May 27, 2009
concept code of NanoTable
View gist:118701
require 'rbtree'
class Nano
class Pivot
def initialize(ary)
@ary = ary
end
end
class Prefix < Pivot
@seki
seki / koto.cgi.rb
Created May 27, 2009
tiny chat for toRubyKaigi
View koto.cgi.rb
#!/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)
View sbb.rb
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
View notify.rb
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
View card.rb
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)
View agent.rb
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
View notify.rb
#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')
View hello_client.rb
require 'drb/drb'
DRb.start_service
ro = DRbObject.new_with_uri('druby://localhost:54000')
ro.hello
View hash.rb
#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.'
View deq.rb
require 'drb/drb'
DRb.start_service
queue = DRbObject.new_with_uri('druby://localhost:54320')
while true
p queue.pop
sleep(rand)
end
You can’t perform that action at this time.