Skip to content

Instantly share code, notes, and snippets.

@kysnm
kysnm / 1_50.rb
Created February 12, 2012 12:48
離散数学読書会(@2012-02-12)
def myset(a1, a2)
h = Hash.new(0)
a1.each{|a| h[a] += 1}
a2.each{|a| h[a] += 1}
puts "a and b"
p h.select{|k, v| v == 2}.keys
puts "a or b"
p h.keys
@kysnm
kysnm / gist:1307226
Created October 23, 2011 10:38
AnyEvent::HTTP で 200 以外が帰ってきた時にリトライする
use AnyEvent;
use AnyEvent::HTTP;
my $w;
my $cv = AE::cv;
my @urls = qw{
http://localhost:5000/
http://localhost:5001/
};
my @watchers;
@kysnm
kysnm / google_apps_script
Created June 17, 2011 15:22
GoogleAnalyticsAPI for Google Spreadsheet
var DateTime = function() {
var now = new Date();
this.year = now.getFullYear();
this.month = ('00' + now.getMonth()).slice(-2);
var monthEndDate = new Date(this.year, this.month, 0);
this.startDate = this.year + '-' + this.month + '-01';
this.endDate = this.year + '-' + this.month + '-' + monthEndDate.getDate();
}
var Profile = function(profileName, tableId) {
@kysnm
kysnm / h2o.diff
Last active September 17, 2015 15:14
$ git submodule add git@github.com:kentaro/mruby-hibari.git deps/mruby-hibari
$ cmake -DWITH_MRUBY=ON . && make
$ ./h2o --version && ./h2o -c examples/h2o_mruby/h2o.conf
h2o version 1.5.0-beta2
OpenSSL: OpenSSL 1.0.2d 9 Jul 2015
mruby: YES
[INFO] raised RLIMIT_NOFILE to 10240
fetch-ocsp-response (using OpenSSL 1.0.2d 9 Jul 2015)
fetch-ocsp-response (using OpenSSL 1.0.2d 9 Jul 2015)
h2o server (pid:60181) is ready to serve requests
➜ h2o git:(master) sw_vers
ProductName: Mac OS X
ProductVersion: 10.9.5
BuildVersion: 13F34
➜ h2o git:(master) openssl version
OpenSSL 0.9.8za 5 Jun 2014
➜ h2o git:(master) git checkout refs/tags/v1.2.0 -b v1.2.0
Switched to a new branch 'v1.2.0'
➜ h2o git:(v1.2.0) vim examples/libh2o/simple.c
1 /*
➜ h2o git:(v1.2.0) ✗ sw_vers -productVersion
10.9.5
➜ h2o git:(v1.2.0) ✗ openssl version
OpenSSL 0.9.8za 5 Jun 2014
➜ h2o git:(master) ✗ git checkout refs/tags/v1.2.0 -b v1.2.0
Switched to a new branch 'v1.2.0'
➜ h2o git:(v1.2.0) ✗ git log
➜ h2o git:(v1.2.0) ✗ cmake -DWITH_BUNDLED_SSL=on . && make
-- checking for module 'libwslay'
-- package 'libwslay' not found
➜ nghttp2 git:(master) nghttp --verbose https://localhost
[ 0.002] Connected
[ 0.004][NPN] server offers:
* h2
* h2-16
* h2-14
The negotiated protocol: h2-16
[ 0.007] send SETTINGS frame <length=12, flags=0x00, stream_id=0>
(niv=2)
[SETTINGS_MAX_CONCURRENT_STREAMS(0x03):100]
% h2spec -p 8080 -h `boot2docker ip`
The VM's Host only interface IP address is:
3.5. HTTP/2 Connection Preface
✓ Sends invalid connection preface
4.2. Frame Size
✓ Sends too small size frame
✓ Sends too large size frame
% make
git submodule init
git submodule update
cd /tmp/src/trusterd/mruby && cp -f ../build_config.rb . && rake
GIT CHECKOUT master
Already on 'master'
Your branch is up-to-date with 'origin/master'.
GIT CHECKOUT master
Already on 'master'
Your branch is up-to-date with 'origin/master'.
decode_tables_: {
prefix_length: 0, indexed_length: 9, entries_offset: 0
}
decode_tables_.size(): 1
decode_entries_: {
next_table_index: 0, length: 2, symbol_id: 2
next_table_index: 0, length: 2, symbol_id: 2
next_table_index: 0, length: 2, symbol_id: 2