Skip to content

Instantly share code, notes, and snippets.

# https://www.ibm.com/developerworks/jp/linux/library/l-pythrd/
from __future__ import generators;
import time;
threads = []
TIMES = 100000
def stringops():
for n in xrange(TIMES):
s = "Mary had a little lamb"
@koyachi
koyachi / fill_area.rb
Created August 18, 2012 10:46
塗りつぶし + 識別
require 'logger'
require 'pp'
$log = Logger.new(STDOUT)
$log.level = Logger::DEBUG
class Image
attr_accessor :width, :height, :pixels
def initialize(width, height)
@koyachi
koyachi / gist:2872722
Created June 5, 2012 04:51
CWDの写真をandroid端末(emulator)に転送
ls | grep -e "jpe*g" -i | xargs -I P1 adb -e push P1 /sdcard/DCIM/100ANDRO/
@koyachi
koyachi / test.coffee
Created May 29, 2012 00:42
hubot-scripts-for-trac/_tmp/test.coffee
# tests for hubot-scripts-for-trac
#
# 2012-05-29 koyachi
trac = require '../scripts/trac'
matched = 0
dummyRobot = {
hear: (re, f) ->
if matched == 1
return
@koyachi
koyachi / frame__aachan.bvh.png
Created April 1, 2012 06:13
http://perfume-dev.github.com/ から得られるBVHの数値を適当に色にした
frame__aachan.bvh.png
@koyachi
koyachi / gist:1992610
Created March 7, 2012 11:20
先頭/末尾にrubyってつくgemの数を数えた
# 結果: /^ruby-.*/が多い
# 参考: http://kyow.cocolog-nifty.com/blog/2010/12/rubygems-d629.html
#
% gem list -r | grep -e "^ruby-" | wc -l
341
% gem list -r | grep -e "^ruby_" | wc -l
73
% gem list -r | grep -e ".*_ruby (" | wc -l
31
% gem list -r | grep -e ".*-ruby (" | wc -l
require 'coreaudio'
dev = CoreAudio.default_output_device
buf = dev.output_loop(44000)
line = ARGV[0]
puts line
44000.times do |t|
# buf[i] = 0x3FFF * rand()
# via
# - http://www.fraction.jp/log/archives/2008/01/10/extract_mp3_from_flv_for_Ruby
# - http://sourceforge.net/projects/jtoothpaste/
# - http://jdownloader.org
module Flv2mp3
class ::IO
def read_ui24
("\000" + self.read(3)).unpack('N')[0]
end