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
#include <M5Stack.h> | |
#define NBIN 30 | |
static int16_t s_ring[NBIN]; | |
static int s_curr; | |
static int16_t s_bg; | |
static int s_delay = 20000; | |
static unsigned long s_tm; | |
void setup() { |
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 '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 |
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' | |
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} |
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 'rugged' | |
require 'cgi' | |
class Grip | |
def initialize(dir) | |
@dir = dir | |
@git = Rugged::Repository.new(@dir) rescue git_init | |
@author = {email: '[email protected]', name: 'seki'} | |
@message = 'via grip' | |
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
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 |
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 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 |
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
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) |
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 'my_drip' | |
MyDrip.invoke | |
def root | |
Root.new | |
end | |
class Root | |
class VersionMismatchError < RuntimeError; 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
** テーマ『自画自讃』 | |
とちぎテストの会議05を開催します。 | |
** 概要 | |
- 日時: 2018/05/12(土) 11:00 | |
- 場所: [http://nasu-hh.com:title=那須野が原ハーモニーホール] | |
- 定員: 50名 | |
** タイムテーブル | |
- 11:00 開場 |
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 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) |