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 static org.hamcrest.CoreMatchers.*; | |
import static org.junit.Assert.*; | |
import static org.junit.matchers.JUnitMatchers.*; | |
import static org.mockito.Mockito.*; |
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
mvn eclipse:eclipse -DdownloadJavadocs=true |
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
/** | |
* 正規分布乱数関数 参考:http://d.hatena.ne.jp/iroiro123/20111210/1323515616 | |
* @param number m 平均μ | |
* @param number s 分散σ^2 | |
* @return number ランダムに生成された値 | |
*/ | |
var normRand = function (m, s) { | |
var a = 1 - Math.random(); | |
var b = 1 - Math.random(); | |
var c = Math.sqrt(-2 * Math.log(a)); |
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
// 何かしらのログを出力する処理 | |
verify(mockAppender).doAppend(argThat(new ArgumentMatcher<LoggingEvent>() { | |
@Override | |
public boolean matches(Object argument) { | |
return ((LoggingEvent)argument).getFormattedMessage().contains("initOption() fail perse."); | |
} | |
})); | |
} |
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
#標準出力にスレッドダンプを出す | |
kill -3 {pid} | |
#起動引数などを含めてJavaプロセスID表示 | |
/usr/java/default/bin/jps -vlm | |
#ヒープ概要表示 | |
/usr/java/default/bin/jmap -heap {java pid} | |
#ヒープダンプをファイルに取得(visualvmなどで確認可) |
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
// TODO var_dumpを消す! by Soichiro Yoshimura | |
ini_set('xdebug.var_display_max_data', 1048576); | |
ini_set('xdebug.var_display_max_depth', 20); | |
print_r("\n!DEBUG! var_dump at " . __FILE__ . "(" . __LINE__ . ")" . ": " . __CLASS__ . "#" . __FUNCTION__ . "\n"); | |
var_dump(varname); |
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
mkdir -p ~/local/bin; cd ~/local/bin; wget "http://betterthangrep.com/ack-standalone" -O ack;chmod 755 ack; |
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 . -type f -regex '.*/\..*' | grep -v '.svn' | xargs svn add |
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
$ mkdir -p $HOME/local/source | |
$ cd $HOME/local/source | |
$ wget "https://github.com/ggreer/the_silver_searcher/archive/master.zip" --no-check-certificate | |
$ unzip the_silver_searcher-master.zip | |
$ cd the_silver_searcher-master | |
$ sed -i -e "s/configure/configure --prefix=\$HOME\/local/g" build.sh | |
$ ./build.sh | |
$ make install |
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
object DepthFirstSearch { | |
def main(args: Array[String]) { | |
val n = 20 | |
val a = List(1, 10, 49, 3, 8, 13, 7, 23, 60, -500, 42, 599, 45, -23, 1, 10, 49, 3 ,8, 13) | |
val k = 444 | |
// リストの要素を最初から足すか足さないかという2択で考え、4つの場合なら | |
// 足さない, 足さない, 足さない, 足さない | |
// 足さない, 足さない, 足さない, 足す | |
// 足さない, 足さない, 足す, 足さない |