This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data = File.read('hoge.txt') | |
timestamps = data.scan(/2005\/05\/26\(木\)\s(\d{2}:\d{2}:\d{2})/) | |
p timestamps.length | |
hash = {} | |
timestamps.each do |timestamp| | |
if hash[timestamp].nil? | |
hash[timestamp] = 1 | |
else | |
hash[timestamp] += 1 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# ソースコードリーティング支援スクリプト | |
# -------------------------------------- | |
# 特定のディレクトリ下のファイルを再帰的に読み込み、大きなテキストファイルにする | |
# プリントアウトして読むためのソースを作ることを目的としている | |
# | |
$KCODE = 'u' | |
require 'jcode' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Rule(object): | |
""" Handles each routing rule. """ | |
def __init__(self, pattern, **param): | |
super(Rule, self).__init__() | |
self.pattern = pattern[:-1] if pattern.endswith('/') else pattern | |
self.regex = self.pattern | |
self.param = param | |
self.matches = re.findall(':([^/.]+)', self.pattern) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// http://wpdocs.sourceforge.jp/プラグイン_API#Filters | |
// wordpress向けプラグイン | |
// これはモックです動作しません。 | |
// 自動リンクを生成する | |
function mindia_autolink_filter($content) { | |
$username = 'hoge'; | |
$words = something_api($username); | |
$linked_words = array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" ?> | |
<Module> | |
<ModulePrefs title="Hello Wave"> | |
<Require feature="wave-preview" /> | |
</ModulePrefs> | |
<Content type="html"> | |
<![CDATA[ | |
Hello, Wave! | |
]]> | |
</Content> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// | |
// This program is free software; you can redistribute it and/or | |
// modify it under the terms of the GNU General Public License | |
// as published by the Free Software Foundation; either version 2 | |
// of the License, or (at your option) any later version. | |
// | |
// This program is distributed in the hope that it will be useful, | |
// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*** config_old.py 2009-10-26 10:45:06.000000000 +0900 | |
--- config_new.py 2009-10-26 10:47:58.000000000 +0900 | |
*************** | |
*** 108,113 **** | |
--- 108,114 ---- | |
if not len(flist): | |
return {} | |
flist = string.split(flist, ",") | |
+ flist = map(lambda x: string.strip(x), flist) | |
formatters = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#`wget http://www.python.org/ftp/python/2.5.5/Python-2.5.5.tar.bz2` | |
#`tar -jxf Python-2.5.5.tar.bz2` | |
#`cd Python-2.5.5` | |
#`./configure` | |
#`make` | |
#`sudo make install` | |
lines = <<-CODE | |
wget http://www.python.org/ftp/python/2.5.5/Python-2.5.5.tar.bz2 | |
tar -jxf Python-2.5.5.tar.bz2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$KCODE="utf-8" | |
puts 'You\'re swell!' | |
puts "Youre swell!" | |
puts "文字列最後の円マーク: \\" | |
puts "\\2,500" | |
puts "\\2,500" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hashlib | |
import datetime | |
loop_size = 100 *1000 | |
start_time = datetime.datetime.now() | |
for i in range(loop_size): | |
source_data = '123456%d' % i | |
v = hashlib.sha256(source_data).hexdigest() | |
end_time = datetime.datetime.now() |
OlderNewer