Skip to content

Instantly share code, notes, and snippets.

View cho45's full-sized avatar

Satoh, Hiroh cho45

View GitHub Profile
@cho45
cho45 / worker.pl
Last active August 29, 2015 13:56
#!/usr/bin/env perl
use utf8;
use strict;
use warnings;
use lib lib => glob 'modules/*/lib';
use constant MAX_WORKER => 2;
use constant MAX_REQUEST_PER_CHILD => 100;
use constant INTERVAL => $ENV{INTERVAL} || 5;
use constant NAMESPACE => 'MyApp::Worker';
@cho45
cho45 / e2erun
Last active January 2, 2016 21:49
#!/usr/bin/env ruby
require "glint"
ENV['RACK_ENV'] = 'test'
server = Glint::Server.new do |port|
require "rack"
require "webrick"
@cho45
cho45 / rb.rb
Created December 29, 2013 03:40
#!/usr/bin/env ruby
class I2CDevice
# ioctl command
# Ref. https://www.kernel.org/pub/linux/kernel/people/marcelo/linux-2.4/include/linux/i2c.h
I2C_RETRIES = 0x0701
I2C_TIMEOUT = 0x0702
I2C_SLAVE = 0x0703
I2C_SLAVE_FORCE = 0x0706
I2C_TENBIT = 0x0704
@cho45
cho45 / rb.rb
Last active January 1, 2016 10:49
#!/usr/bin/env ruby
# coding: utf-8
class I2CDevice
# ioctl command
# Ref. https://www.kernel.org/pub/linux/kernel/people/marcelo/linux-2.4/include/linux/i2c.h
I2C_RETRIES = 0x0701
I2C_TIMEOUT = 0x0702
I2C_SLAVE = 0x0703
I2C_SLAVE_FORCE = 0x0706
@cho45
cho45 / binding.rb
Last active December 30, 2015 21:39
#!ruby
p RUBY_VERSION
b = binding
eval("a = 1", b)
eval("p a", b) # => 1
p a # undefined local variable or method `a' for main:Object (NameError)
@cho45
cho45 / tuishi.pl
Last active December 28, 2015 02:08
use v5.14;
use utf8;
sub foo {
say wantarray ? 'wantarray!!' : "scalar!!!";
shift;
}
say "list context";
say "||";
{
my @a = qw(a b c);
my @b = qw(d e f);
my @foo = @a || @b;
use Data::Dumper;
warn Dumper @foo ;
#=> $VAR1 = 3;
}
@cho45
cho45 / a.md
Last active December 27, 2015 01:39
便利な表です
文系 理系
体育系 ゴミ
文化系 無能 勝者
@cho45
cho45 / Foo.scala
Last active December 24, 2015 23:19
object Foo {}
diff --git a/t/040_tterse/013_wrapper.t b/t/040_tterse/013_wrapper.t
old mode 100644
new mode 100755
index df6c8dc..1b54806
--- a/t/040_tterse/013_wrapper.t
+++ b/t/040_tterse/013_wrapper.t
@@ -69,6 +69,20 @@ X
T
Hello, TTerse world!
X