made with esnextbin
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
private static FloatMatrix multiply(FloatMatrix A, FloatMatrix B, boolean local) throws IOException { | |
if (A.getColumnDimension() != B.getRowDimension()) { | |
throw new IllegalArgumentException("Matrix inner dimensions must agree."); | |
} | |
CLContext context = JavaCL.createBestContext(); | |
CLQueue queue = context.createDefaultQueue(); | |
int resultLength = A.getRowDimension() * B.getColumnDimension(); | |
Pointer<Float> aPtr = matrixToPointer(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
import com.twitter.app.App | |
object MyApp extends App { | |
def main() { | |
println("Hello, World") | |
} | |
} |
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 com.twitter.app.App | |
object MyApp extends App { | |
// parses an integer from the "-port" flag. | |
// Finagle already provides an implicit Flaggable typeclass for Int | |
// usage: -port 9000 | |
val port = flag[Int]("port", 8080, "port this server should use") | |
// parses an Env trait. See typeclass below |
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
namespace * net.gutefrage.temperature.thrift | |
/** | |
* temperature in celisus and timestamp in UTC milliseconds | |
*/ | |
struct TemperatureDatum { | |
1: i32 celsius, | |
2: i64 timestamp | |
} |
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 net.gutefrage.temperature.thrift._ | |
import com.twitter.finagle.ThriftMux | |
// this is the raw implementation with the twitter Future based API | |
val service = new TemperatureService.FutureIface { | |
override def add(datum: TemperatureDatum): Future[Unit] = ??? | |
override def mean(): Future[Double] = ??? | |
} |
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 net.gutefrage | |
import com.twitter.app.App | |
import com.twitter.conversions.time._ | |
import com.twitter.finagle.{ThriftMux} | |
import com.twitter.finagle.util.DefaultTimer | |
import com.twitter.util.{Await, Future} | |
import net.gutefrage.temperature.thrift._r | |
/** |
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 net.gutefrage | |
import com.twitter.finagle.Dtab | |
/** | |
* Holds different delegation tables | |
*/ | |
object Dtabs { | |
def init(): Unit = { |
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 flaggable type class | |
import Env._ | |
// start a service in an environment with | |
// --env prod | |
val env = flag[Env]("env", Env.Local, "environment this server runs") | |
val port = flag[Int]("port", 8080, "port this server should use") | |
val server = ThriftMux.server | |
.withLabel("temperature-service") |
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 net.gutefrage | |
import com.twitter.app.App | |
import com.twitter.conversions.time._ | |
import com.twitter.finagle.{ThriftMux} | |
import com.twitter.finagle.util.DefaultTimer | |
import com.twitter.util.{Await, Future} | |
import net.gutefrage.temperature.thrift._r | |
/** |