This file contains hidden or 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
" You need https://github.com/tyru/open-browser.vim to open browser. | |
function! OpenTrac() "{{{ | |
let s:id = expand('<cword>') | |
if s:id =~ '^[0-9]\+$' | |
call openbrowser#open("http://trac.example.com/trac/ticket/" . s:id) | |
endif | |
endfunction "}}} | |
command! OpenTrac call OpenTrac() |
This file contains hidden or 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
/** | |
* A jQuery plug-in to switch the action of forms by a select element. | |
* Each forms must have data-api attribute. | |
* | |
* EXAMPLE: | |
* | |
* <select name="actionBase"> | |
* <option value="http://localhost/">localhost</option> | |
* <option value="http://dev.example.com/">dev server</option> | |
* </select> |
This file contains hidden or 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
nohup コマンドは、プロセスをデーモンとして動かすときの貧者の方法だ。 | |
Bruno Ranschaert が書いているように、インタラクティブシェルでコマンドを起動す | |
ると、それは制御ターミナルを持ち、制御プロセス(一般にログインシェル)が終了 | |
した時に SIGHUP (ハングアップ)シグナルを受け取る。nohup コマンドは、入力を | |
/dev/null として、出力とエラーを nohup.out に向けて、プログラムが割り込み、終 | |
了、ハングアップのシグナルを無視するようにする。制御ターミナルは同じものを持ち | |
続けるが、ターミナルからの制御を無視するようになる。バックグラウンドでプロセス | |
を動かしたい場合には、末尾の & などでシェルにそれを伝える必要がある。 | |
一般に nohup で動くプロセスは長時間動作するが、インタラクティブな入力を待機す |
This file contains hidden or 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
public class HttpSample { | |
public static void main(String[] args) { | |
sendRequest("http://example.com/", data -> { | |
System.out.println("data is " + data); | |
}, error -> { | |
System.out.println("error ><"); | |
}); | |
sendRequest("http://naiyo.naiyo/", data -> { |
This file contains hidden or 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
public class LifeAtTwitter { | |
public static void main(String[] args) { | |
getTweets().forEach(tweet -> { | |
System.out.println(tweet); | |
}); | |
} | |
static java.util.List<String> getTweets() { | |
return java.util.Arrays.asList("mukuri", "syussya", "meshi", "kitaku", "oyasu"); |
This file contains hidden or 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
task :install_java | |
jdk_filename = "jdk-6u39-linux-x64-rpm.bin" | |
upload(jdk_filename, "/tmp/#{jdk_filename}") | |
run "chmod a+x /tmp/#{jdk_filename}" | |
run "#{sudo} /tmp/#{jdk_filename}", :pty => true do |channel, stream, data| | |
channel.send_data("\n") if data.start_with? "Press Enter to continue" | |
puts data unless data.empty? | |
end | |
end |
This file contains hidden or 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 xlrd | |
import sys | |
if len(sys.argv) < 2: | |
print "python %s xxx.xls" % sys.argv[0] | |
sys.exit(1) | |
filename = sys.argv[1] | |
if filename.startswith("http"): |
This file contains hidden or 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
#!/bin/sh | |
nc -w 10 $IRC_SERVER 6667 << EOF &>/dev/null | |
PASS $IRC_PASS | |
NICK $IRC_NICK | |
USER $IRC_NICK 8 * : $IRC_NICK | |
JOIN $IRC_CH | |
PRIVMSG $IRC_CH : $1 | |
QUIT | |
EOF |
This file contains hidden or 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
REGEX="id=123[^0-9]" | |
echo "id=123" | grep $REGEX &>/dev/null && echo PASS | |
echo "id=123&a=b" | grep $REGEX &>/dev/null && echo PASS | |
echo "id=1234&a=b" | grep $REGEX || echo PASS | |
echo "id=1234" | grep $REGEX || echo PASS |
This file contains hidden or 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
public class RawJsonBodyParser extends Action.Simple { | |
@Override | |
public Result call(Context ctx) throws Throwable { | |
String rawBody = new String(ctx.request().body().asRaw().asBytes()); | |
JsonNode json = Json.parse(rawBody); | |
ctx.args.put("json", json); | |
return delegate.call(ctx); | |
} | |
OlderNewer