- 不変な、状態を持たない、 廃棄可能な
- 「状態管理が面倒なら、状態を管理しなければイイ」
- Chad Fowler
- 「サーバーを捨てろ」
- blue green deployment
- 今まで主流のデプロイ=更新があったプログラムだけ配る
- よく事故る
- gemの依存関係が影響してリスタートしたら動かない
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
object Aho { | |
def main(args: Array[String]) { | |
aaa(1, "2", true) | |
ddd(1, "2", true) | |
} | |
// aaa - ccc, そのまま可変長引数を渡して実行 | |
def aaa(params: Any*) { | |
println("AAA params[%s] params class[%s]".format(params, params.getClass)) |
lxc
- LXC - Wikipedia
- OSレベル の仮想化ソフトウェア
- 完全仮想化(ハードウェアをエミュレート、オーバーヘッド大) - KVM etc
- 準仮想化(ゲストOSがホストOSのAPIを使用、オーバーヘッド中) - Xen, Hyper-V etc。Virtualboxもこちらか
- 仮想機械ではなく、個別のプロセスとネットワークスペースを作り出す仮想環境
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
// private なら、同一クラスの他オブジェクトからアクセス可能 | |
scala> class Hoge (private var aho: Int) { def debug(hoge: Hoge) { println(hoge.aho) } } | |
defined class Hoge | |
// private[this] なら、同一クラスの他オブジェクトからアクセス不可 | |
scala> class Huga (private[this] var aho: Int) { def debug(huga: Huga) { println(huga.aho) } } | |
<console>:7: error: value aho is not a member of Huga | |
class Huga (private[this] var aho: Int) { def debug(huga: Huga) { println(huga.aho) } } |
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
Host nemui | |
Hostname setsuzoku.server | |
User jpshadowapps | |
LocalForward 16667 irc.na.server:6667 # ircサーバのsshトンネル | |
LocalForward 13389 win.na.server:3389 # windowsサーバのsshトンネル。RDCで localhost:13389 とかして接続 | |
LocalForward 15900 mac.na.machine:5900 # mac 画面共有のsshトンネル | |
LocalForward 10022 localhost:22 | |
ProxyCommand ssh [email protected] nc -w 1 %h %p # 多段ssh時の経由サーバ | |
DynamicForward localhost:10080 # socks proxy | |
IdentityFile ~/.ssh/nemui_rsa |
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
package ssbt | |
object HogeMain { | |
def main(args: Array[String]) { | |
val list = getRandomList(50, 500) | |
println("----- start distinct1") | |
repeat(10, repeatDistinct(distinct1[Int], list)) |
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
package ssbt | |
object Euler32 { | |
def main(args: Array[String]) { | |
val permutations = List("1", "2", "3", "4", "5", "6", "7", "8", "9").permutations | |
val pandigitalProducts = permutations.map(getPandigitalProductList(1, _)).toList.filter(_.size > 0) | |
println("Answer %s".format(pandigitalProducts.flatten.distinct.sum)) | |
} |
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
package ssbt | |
object Euler24 { | |
def main(args: Array[String]) { | |
val result = List(0, 1, 2, 3, 4, 5, 6, 7, 8, 9).permutations.zipWithIndex.filter(_._2 == 999999).next._1.mkString | |
println("Answer %s".format(result)) | |
} |
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
object Hoge { | |
def main(args: Array[String]) { | |
for (i <- (1 to 20)) mainRecur(args(0).toInt) | |
} | |
private def mainRecur(ver: Int) { | |
var start = System.nanoTime | |
val s = "\"1\",\"22\",\"333\",\"4444\",\"55555\"" |