2009-03-01から1ヶ月間の記事一覧
なんとなくNgramを実装してみたくなったのでやってみた #!/usr/bin/ruby require 'pp' require 'open-uri' $KCODE = 'u' String.class_eval do def ngram(n) analyzed = Hash.new(0) self.split(//).each_cons(n) do |cons| next if cons.include?("\n") ana…
//svn log -v $ git log --name-status //svn cat -r REV path/to/file $ git cat-file -p REV:path/to/file //svn cat -r REV path/to/file > path/to/file $ git checkout REV path/to/file // rm path/to/file; svn update $ git checkout path/to/file他…
findには-emptyなんてオプションがあった $ find . -type d -emptyしかも-deleteなんてオプションもあった $ find . -type d -empty -delete
余計な機能がついてるのは別のライブラリの一部として作ったため require 'stringio' StringIO.class_eval do def read_format(size, format) bin = read(size) bin = "\000" + bin if size == 3 bin.unpack(format).first end end module Video class Wrong…