Skip to content

Instantly share code, notes, and snippets.

@syonbori
syonbori / killer.ir_bencher.rb
Created February 11, 2013 13:57
FHC v1.04 sound-device-lost test code
#!/bin/env ruby
# -*- coding: utf-8 -*-
require 'net/http'
require 'uri'
KEY = "webapi_hogehugapiyo"
HOST = "fhc"
PORT = 80
BASE_URL = "/api/elec/action?webapi_apikey=#{KEY}"
@syonbori
syonbori / myfhc-timer.rb
Last active December 12, 2015 03:38
Future Home Controller (FHC) expansion test
# -*- coding: utf-8 -*-
require 'sinatra'
require 'fhc4ruby'
ACCEPTABLE_KEY = "FHC_CALL_KEY_STRING"
API_KEY = "webapi_hogehoge"
FHC_HOST = "fhc."
FHC_PORT = 80
get '/myfhc/:key/timer/minutes/:min' do
@syonbori
syonbori / check_date.rb
Created April 2, 2012 11:04
listup the lacking files with date from and date to
#!/usr/bin/ruby
require 'date'
_date_from = ARGV[0]
_date_to = ARGV[1]
target_dir = ARGV[2]
if _date_from.nil? or _date_to.nil?
STDERR.puts "please specify the date_from and date_to."
exit 1
@syonbori
syonbori / latex_filter.rb
Created December 2, 2011 10:44
use Yahoo! Translation via STDIN and utilize from Emacs for editing LaTeX
#!/bin/env ruby
lines = STDIN.readlines
content = ""
lines.each{|l| content << l.chomp << " "}
withdots = %w{
et al
}
# パーセント
@syonbori
syonbori / tig-empty-following.patch
Created August 29, 2011 20:25
patch for TIG error on empty <following></following> elements in User object from XML
Index: TwitterService.cs
===================================================================
--- TwitterService.cs (revision 733)
+++ TwitterService.cs (working copy)
@@ -1924,8 +1924,16 @@
[XmlElement("status")]
public Status Status;
[XmlElement("following")]
- public Boolean Following;
+ private String _following_str;
@syonbori
syonbori / mpserver.rb
Created February 9, 2011 16:04
MPRPC crashes when calling RPC behind heavy Future.get
#!/bin/env ruby
require 'rubygems'
require 'msgpack/rpc'
SIZE_MB = 256
class MPserver
def ultra_heavy_value()
return "A" * SIZE_MB * 1024 * 1024
end
@syonbori
syonbori / syobo_n.rb
Created January 27, 2011 14:57
return (´・ω・`)
#!/bin/env ruby
# -*- coding: utf-8
def syobo_n
´・ω・`="論文はまだですか?"
return (´・ω・`)
end
puts syobo_n
@syonbori
syonbori / MPRPC-Server-nonthread.rb
Created December 12, 2010 15:54
Why MessagePack RPC Server with thread consumes CPU powers?
#!/bin/env ruby
require 'rubygems'
require 'msgpack/rpc'
class MyHandler
def add(x,y) return x+y end
end
svr = MessagePack::RPC::Server.new
svr.listen('0.0.0.0', 18800, MyHandler.new)