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 |
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
<html> | |
<head> | |
<title>QR</title> | |
</head> | |
<body> | |
<form action="http://localhost/cgi-bin/qr.rb" method="post"> | |
<textarea name="t" cols="80" rows="15"> | |
</textarea> | |
<input type="submit" name="QR" value="QR" /> | |
</form> |
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
module Enumerable | |
class Reverse | |
def initialize(value) | |
@value = value | |
end | |
attr_reader :value | |
def <=>(other) | |
- (@value <=> other.value) | |
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
# -*- coding: utf-8 -*- | |
require 'hpricot' | |
require 'open-uri' | |
require 'erb' | |
class PokemonCardCom | |
def host | |
'http://www.pokemon-card.com' | |
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
#!/bin/sh | |
echo timer > /sys/class/leds/led0/trigger | |
echo 250 > /sys/class/leds/led0/delay_on | |
echo 125 > /sys/class/leds/led0/delay_off |