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
package nodescala | |
import scala.language.postfixOps | |
import com.sun.net.httpserver._ | |
import scala.concurrent._ | |
import scala.concurrent.duration._ | |
import ExecutionContext.Implicits.global | |
import scala.async.Async.{async, await} | |
import scala.collection._ |
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
package simulations | |
import math.random | |
class EpidemySimulator extends Simulator { | |
def randomBelow(i: Int) = (random * i).toInt | |
protected[simulations] object SimConfig { | |
val population = 300 | |
val roomRows = 8 |
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
/** | |
* Copyright (C) 2009-2013 Typesafe Inc. <http://www.typesafe.com> | |
*/ | |
package actorbintree | |
import akka.actor._ | |
import scala.collection.immutable.Queue | |
object BinaryTreeSet { | |
trait Operation { |
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
// MongoDB's DB creation benchmark: | |
// * データベースを作る前にデータベース用のユーザを作成。 | |
// * そのユーザ権限でデータベースを作成。 | |
// * コレクションを10個、ドキュメントを10個、フィールドを10個ずつ作成。 | |
// * 作成データベース数は10000 | |
// | |
// 1. | |
// | |
// Start MongoDB server without "--auth" option, and create a bootstrap admin user: | |
// use admin |
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
# Autoretry failed command 10 times, with 1-60s random delay: | |
# https://unix.stackexchange.com/questions/82598 | |
for i in $(seq 1 10); do [ $i -gt 1 ] && delay=$[$RANDOM % 60 + 1] && echo "Retry after ${delay}s" && sleep $delay; command "$1" && failed=0 && break || failed=$?; done; (exit $failed) |
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
package recfun | |
import scala.collection.mutable.ListBuffer | |
import common._ | |
/** https://class.coursera.org/progfun-2012-001/assignment/view?assignment_id=4 */ | |
object Main { | |
def main(args: Array[String]) { | |
println("Pascal's Triangle") | |
for (row <- 0 to 10) { |
OlderNewer