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 / 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 / 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)
@seki
seki / interp.rb
Last active Feb 2, 2018
minruby.succ
View interp.rb
require "minruby"
def mark_tail(tree, genv)
case tree && tree[0]
when "func_call"
mhd = genv[tree[1]]
if mhd == nil || mhd[0] == "user_defined"
tree[0] = "tail"
end
when "stmts"
View drb.rb.patch
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
@seki
seki / main.m
Created Oct 11, 2017
test tool for AB shutter (Bluetooth Remote Shutter)
View main.m
//
// 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
You can’t perform that action at this time.