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
View rubyxl_test.rb
require 'rubyXL'
require 'rubyXL/convenience_methods'
workbook = RubyXL::Parser.parse('201909.xlsx')
puts workbook[0].sheet_name
row = 4
while x = workbook[0][row][3].value
puts x
row += 2
end
@seki
seki / forktest.rb
Last active Oct 14, 2019
close on fork
View forktest.rb
require 'drb'
def test_fd
sleeper = DRbObject.new_with_uri('druby://localhost:50097')
ary = 20.times.collect {
Thread.new { sleeper.sleep(5) }
}
ary.each {|th| th.join}
@seki
seki / grip.rb
Created Jul 7, 2019
a simple kvs using git (rugged)
View grip.rb
require 'rugged'
require 'cgi'
class Grip
def initialize(dir)
@dir = dir
@git = Rugged::Repository.new(@dir) rescue git_init
@author = {email: 'seki@ruby-lang.org', name: 'seki'}
@message = 'via grip'
end
View crawler.rb
require 'thread'
class Crawler
def initialize(root='.', pattern='**/*.rb', period=5)
@root = File.expand_path(root)
@pattern = pattern
@period = period
@last = {}
@queue = SizedQueue.new(2)
end
@seki
seki / sqlite3-util.rb
Created Aug 27, 2018
sqlite3-util.rb
View sqlite3-util.rb
class SQLite3::Database
def statement(s)
if @cache.nil?
@cache = Hash.new { |h, k| h[k] = self.prepare(k) }
end
@cache[s]
end
end
class SQLite3::Statement
@seki
seki / drb.rb
Created Jun 5, 2013
1st druby. [ruby-list:15406]
View drb.rb
drb.rb
#!/usr/local/bin/ruby
=begin
Tiny distributed Ruby --- dRuby
DRb --- dRuby module.
DRbProtocol --- Mixin class.
DRbObject --- dRuby remote object.
DRbConn ---
DRbServer --- dRuby message handler.
=end
@seki
seki / fact.rb
Created May 27, 2018
MinRuby with Rinda
View fact.rb
write("fact", 1, 1)
n = 2
while n <= 10
eval("fact", n, take("fact", n - 1, nil)[2] * n)
n = n + 1
end
p take("fact", 10, nil)
@seki
seki / root.rb
Last active Apr 30, 2018
minruby + STM
View root.rb
require 'my_drip'
MyDrip.invoke
def root
Root.new
end
class Root
class VersionMismatchError < RuntimeError; end
@seki
seki / 05_toteka.txt
Last active Mar 18, 2018 — forked from vestige/05_toteka.txt
05下書き
View 05_toteka.txt
** テーマ『自画自讃』
とちぎテストの会議05を開催します。
** 概要
- 日時: 2018/05/12(土) 11:00
- 場所: [http://nasu-hh.com:title=那須野が原ハーモニーホール]
- 定員: 50名
** タイムテーブル
- 11:00 開場
View digdig.rb
class Array
def keys
0...size
end
end
def find(it, key, &blk)
it.keys.each do |k|
v = it[k]
k == key ? yield(v) : find(v, key, &blk)
You can’t perform that action at this time.