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 av_server.rb
require 'av_capture'
require 'drb'
class PhotoServer
attr_reader :worker
def initialize
@worker = Queue.new
end
@seki
seki / rinda_sizedqueue.rb
Last active Aug 29, 2015
YA SizedQueue, uses pattern [key, Range, Array].
View rinda_sizedqueue.rb
class ChannelSpace
class ChannelHandle
def initialize(ts, size)
@ts = ts
@size = size
@name = Object.new
@ts.write([@name, 0, []])
end
def write(value)
View channel.rb
# -*- coding: utf-8 -*-
require 'rinda/tuplespace'
module Channel
class ChannelSpace
class Any
def initialize(ary)
@ary = ary
end
View channel_space.rb
require 'rinda/tuplespace'
class ChannelSpace
include DRbUndumped
class ChannelError < RuntimeError
def initialize(str, handle)
@channel = handle
super(str)
end
@seki
seki / rpg.rb
Created Jan 25, 2015
for OSX. It will give my talk to you using Kyoko.
View rpg.rb
rate = 210
while line = gets
line.chomp!
puts
if line.empty?
sleep(0.7)
next
end
puts(line)
IO.popen("say -r #{rate}", "w") do |say|
@seki
seki / HC-SR04.rb
Last active Aug 29, 2015
HC-SR04.rb
View HC-SR04.rb
module GPIO
module_function
def export(n, dir)
File.open("/sys/class/gpio/export", "w") do |fp|
fp.write(n.to_s)
end
sleep 0.1
File.open("/sys/class/gpio/gpio#{n}/direction", "w") do |fp|
fp.write(dir)
@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)
@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
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
You can’t perform that action at this time.