As configured in my dotfiles.
start new:
tmux
start new with session name:
| // scala 2.7 simple type constraint. This can only constrain a type parameter of this function. | |
| // Below, in ListW.sumint28, we can't use this approach because we want to constrain T, | |
| // a type param of the enclosing trait. | |
| def sumint27A[T <: Int](l: List[T]) : Int = l.reduceLeft((a: Int, b: Int) => a + b) | |
| trait IntLike[X] extends (X => Int) | |
| object IntLike { | |
| implicit val intIntLike: IntLike[Int] = new IntLike[Int] { def apply(x: Int) = identity(x) } | |
| } |
| var flattenObject = function(ob) { | |
| var toReturn = {}; | |
| for (var i in ob) { | |
| if (!ob.hasOwnProperty(i)) continue; | |
| if ((typeof ob[i]) == 'object') { | |
| var flatObject = flattenObject(ob[i]); | |
| for (var x in flatObject) { | |
| if (!flatObject.hasOwnProperty(x)) continue; |
As configured in my dotfiles.
start new:
tmux
start new with session name:
| /* | |
| Copyright 2012-2021 Viktor Klang | |
| Licensed under the Apache License, Version 2.0 (the "License"); | |
| you may not use this file except in compliance with the License. | |
| You may obtain a copy of the License at | |
| http://www.apache.org/licenses/LICENSE-2.0 | |
| Unless required by applicable law or agreed to in writing, software |
| # Option defaults | |
| OPT="value" | |
| # getopts string | |
| # This string needs to be updated with the single character options (e.g. -f) | |
| opts="fvo:" | |
| # Gets the command name without path | |
| cmd(){ echo `basename $0`; } |
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
Test with
$ sbt run
And then,
$ curl localhost:8080/mars/hi
$ curl localhost:8080/jupiter/hi