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 'nokogiri' | |
require 'open-uri' | |
fname = ARGV.shift | |
if fname | |
html = File.read(fname) | |
else | |
url = "http://dicom.nema.org/medical/dicom/current/output/chtml/part06/chapter_6.html" | |
html = URI.open(url).read | |
File.write("/tmp/chapter6.html", html) |
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: us-ascii | |
require 'pp' | |
class Dcm | |
module ImplicitLittle | |
def read_tag; read(4).unpack('vv') end | |
def read_vr; nil; end | |
def read_i2; read(2).unpack('v').first end | |
def read_i4; read(4).unpack('V').first 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: us-ascii | |
module DCM_CharSet | |
class InvalidCharSet < RuntimeError | |
end | |
# https://github.com/cornerstonejs/dicomParser/issues/146 | |
module_function | |
def parse_charset(dcm_00080005) | |
charset = dcm_00080005 | |
ary = charset ? charset.strip.split('\\').map {|x| x.strip.upcase} : [] |
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 'discordrb' | |
module Discordrb::Voice | |
class VoiceBot | |
def play_internal | |
count = 0 | |
@playing = true | |
# Default play length (ms), will be adjusted later | |
@length = IDEAL_LENGTH |
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
name = ARGV.shift || 'p5.pgm' | |
buf = "P5 256 256 65535\n" + (0...(256 ** 2)).to_a.pack('n*') | |
File.write(name, buf) |
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 'serialport' | |
require 'json' | |
class EpeaNdir07 | |
def initialize | |
@dev = "/dev/tty.usbserial-12210" | |
end | |
def get_ppm | |
sp = SerialPort.new(@dev, 115200) |
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
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<style> | |
.bubble { | |
transition: all 0.5s; | |
} | |
</style> |
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 'erb' | |
class ERB | |
class ERBOut | |
Buffer = String # SafeBuffer if rails | |
def initialize(s='') | |
@str = Buffer.new(s) | |
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 'rinda/tuplespace' | |
class Rdv | |
def initialize(ts=nil) | |
@ts = ts || Rinda::TupleSpace.new | |
end | |
def select?(*chan) | |
template = Template.new(*chan) | |
t, k = @ts.take([template, nil]) |