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
# local -> proxy_host -> web??, db??, etc... を想定 | |
# proxy_user, proxy_user_id_rsa はそれぞれ踏み台サーバのユーザーと鍵 | |
Host web?? db?? | |
ProxyCommand ssh proxy_host nc -w 3600 %h %p | |
User proxy_user | |
IdentityFile ~/.ssh/proxy_user_id_rsa |
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
var page = require('webpage').create(); | |
page.onResourceRequested = function(request) { | |
console.log('Request (#' + request.id + '): ' + request.url); | |
}; | |
page.open(phantom.args[0] || 'http://google.com', function() { | |
console.log('loaded'); | |
phantom.exit(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
javascript:(function() {var str = '[' + document.title.replace(/\|/g, '\\|') + '](' + window.location.href + ')'; window.prompt('markdown link', str);})(); |
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
$ perl -MTime::Piece -le 'my $now = localtime->epoch; print $now;' | |
1355125319 |
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
$ perl -MData::Dumper -le 'my $a = +{}; $a->{foo}->{bar}++; $a->{foo}->{bar}++; $a->{foo}->{baz}++; $a->{blah}->{blah}++; print Dumper $a;' | |
$VAR1 = { | |
'blah' => { | |
'blah' => 1 | |
}, | |
'foo' => { | |
'bar' => 2, | |
'baz' => 1 | |
} | |
}; |
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
% perl -le 'my $input = "300x250"; print "abort" unless $input =~ /(\d+)x(\d+)/; my ($w, $h) = ($1, $2); print "$1 x $2";' | |
300 x 250 |
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
$ python -c 'from markdown import markdown; import codecs; print markdown(open("/Users/kosei/projects/please-sleep/posts/zsh-builtin-command-fc.md").read().decode("utf-8")).encode("utf-8");' | |
<ul> | |
<li> | |
<p>nix: zsh の fc ビルトインコマンド | |
<code>fc</code> はコマンドの履歴操作をおこなう汎用的なコマンドで, たとえば <code>history</code> は zsh だと <code>fc -l</code> のエイリアスだったりする.</p> | |
</li> | |
<li> | |
<p><code>history</code> のように普通に履歴を表示するだけだったら <code>-l</code> オプションをつける.</p> | |
</li> | |
<li><code>-n</code> でコマンドの通し番号を表示しない</li> |
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
$ pwd | |
/Users/kosei | |
$ date +%s | |
1355044489 |
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
$ python -c 'import os; print os.environ["SHELL"]; print os.environ["HISTFILE"]' | |
/bin/zsh | |
Traceback (most recent call last): | |
File "<string>", line 1, in <module> | |
File "/Users/kosei/.virtualenvs/dev/bin/../lib/python2.7/UserDict.py", line 23, in __getitem__ | |
raise KeyError(key) | |
KeyError: 'HISTFILE' |
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
$ python -c 'print 1 if [] else 0' | |
0 | |
$ python -c 'print 1 if [1] else 0' | |
1 |