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
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)) |
- ざっくり概要として、CMDとENTRYPOINT どちらを使うかによって
docker run CONTAINER_ID <command>
した際の<command>
が及ぼす影響 が変わる
- Dockerfile
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
func BinarySearch(data []int, find int, from int, to int) int { | |
center := (from + to) / 2 | |
if from > to { | |
return -1 | |
} | |
if find == data[center] { | |
return center | |
} else if find < data[center] { |
Goの並行処理は 共有変数をチャネル上で引き回し、実行中の異なるスレッドからは同時アクセスさせない という手法を採用しています。
これを実現するために独自のプロセス/スレッド/軽量プロセス/コルーチンモデルを持っていて、このモデルを ゴルーチン(goroutine) といいます
並行処理実践の初歩段階では 正しく逐次動作するソースコードを書き、並列に動作させる改良を加える というアプローチを取った方が無難です。いきなり並行処理を書こうとするとデバッグの際に並行化の誤りなのかアルゴリズムの誤りなのかを判断するのが難しくなります。
というわけで、まず例として超単純な逐次処理を書いてみます。1から5の数値を2倍した値を表示するだけの処理です。
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
$ echo "| bindkey | widget|\n|:-----:|:-----|\n$(bindkey -L | awk '{print $2" "$3}' | sed -e 's/ /|/g' | sed -e 's/^/|/g' | sed -e 's/$/|/g')" | |
# https://github.com/defunkt/gist を使用してgistへ投稿 | |
$ echo "| bindkey | widget|\n|:-----:|:-----|\n$(bindkey -L | awk '{print $2" "$3}' | sed -e 's/ /|/g' | sed -e 's/^/|/g' | sed -e 's/$/|/g')" | gist -d "zsh bindkey $(date +'%Y%m%d')" -f zsh_bindkey.md |