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
eleven:ruby mas$ svn diff lib/drb/drb.rb | |
Index: lib/drb/drb.rb | |
=================================================================== | |
--- lib/drb/drb.rb (revision 61162) | |
+++ lib/drb/drb.rb (working copy) | |
@@ -1673,6 +1673,7 @@ | |
client.close unless succ | |
if Thread.current['DRb']['stop_service'] | |
Thread.new { stop_service } | |
+ break |
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
// | |
// main.m | |
// abs3 | |
// | |
// Created by Masatoshi SEKI on 2017/10/12. | |
// Copyright © 2017年 Masatoshi SEKI. All rights reserved. | |
// | |
#if 0 | |
- Connected to device UUID: C9529529-C937-45B4-B3B6-D1476FFB111B Named: AB Shutter3 | |
- UUID 2A50 Read Value: 0x028A2466820100 |
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 Merge | |
def initialize(*fnames) | |
@file = fnames.collect {|fn| MergeFile.new(fn)} | |
delete_empty | |
end | |
def delete_empty | |
@file.delete_if {|f| f.empty?} | |
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 'rinda/tuplespace' | |
require 'drb/drb' | |
require 'webrick' | |
require 'webrick/cgi' | |
class RichRinda < WEBrick::CGI | |
def initialize(ts, *args) | |
super(*args) | |
@ts = ts |
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 'socket' | |
require 'fiber' | |
module Bartender | |
class App | |
def initialize | |
@input = {} | |
@output = {} | |
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
module Enumerable | |
def product_enum(*other) | |
return to_enum(__method__, *other) unless block_given? | |
if other.empty? | |
each {|x| yield([x])} | |
else | |
car, *cdr = other | |
each do |x| | |
car.rewind | |
car.product_enum(*cdr) {|y| yield([x] + y)} |
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' | |
require 'rinda/tuplespace' | |
module Rinda | |
module_function | |
def rinda_eval(ts) | |
ts = DRbObject.new(ts) unless DRbObject === ts | |
pid = fork do | |
Thread.current['DRb'] = nil | |
DRb.stop_service |
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 'drb' | |
class Risp | |
Ptr = Struct.new(:ptr) | |
class Ptr | |
def initialize(ptr) | |
self.ptr = ptr | |
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
# based on http://d.hatena.ne.jp/pcl/20110625/p1 | |
srand(0) | |
class Perceptron | |
def initialize(n_hidden, eta) | |
@n_hidden = n_hidden | |
@n_output = nil | |
@eta = eta | |
@wih = Hash.new{ rand } |
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 -*- | |
module Bartender | |
class App | |
class FDMap | |
def initialize; @map = {}; end | |
def []=(fd, v) | |
@map[fd.to_i] = [fd, v] | |
end | |
def [](fd) | |
_, v = @map[fd.to_i] |