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
Parent = { | |
hoge = 1 | |
} | |
function Parent:new (o) | |
o = o or {} | |
setmetatable(o, self) | |
self.__index = self | |
return o | |
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
find . -name "*.xml" -print0 | xargs -0 ruby -i -p -e '$_.gsub! %r{hoge}, "fuga"' |
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
find . -name *.txt -print0 | xargs -0 ruby -i -p -e '$_.gsub! %r{(foo|bar)}, %q{\1baz}' |
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
SET SQL_SAFE_UPDATES=0; |
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
#!/usr/bin/env ruby | |
# -*- coding: utf-8 -*- | |
module BaseBall | |
class Batter | |
include Comparable | |
attr_accessor :box, :at_box, :hit, :name | |
def initialize arg | |
@box = arg[:box] | |
@at_box = arg[:at_box] |
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
convert input.jpg -resize 1024x1024\> -size 1024x1024 xc:white +swap -gravity center -composite output.jpg |
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
cat hoge.log | awk '{print $5}' | cut -c 14-15 | sort | uniq -c | |
#awkは無条件で5番目を出力 | |
#cut は14から15文字目 | |
#sortはuniqueが前後しかunique化しないから必要。 | |
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
find . -name "*.html" | xargs sed -e 's/hoge/fuga/g' -i '' |
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
awk '{print $1}' access_log | sort | uniq -c | sort -n | tail -5 |
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
require_once 'Benchmark/Timer.php'; | |
$t = new Benchmark_Timer(); | |
$t->start (); | |
$t->setMarker( 't1' ); | |
for($i=0;$i<10000;$i++){ | |
// 処理 | |
} | |
$t->setMarker('m2'); | |
$t->stop(); |