Skip to content

Instantly share code, notes, and snippets.

View muuki88's full-sized avatar
😘
Taking care of my daugther

Muki Seiler muuki88

😘
Taking care of my daugther
View GitHub Profile
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);
@muuki88
muuki88 / esnextbin.md
Last active March 1, 2016 10:21
esnextbin sketch
@muuki88
muuki88 / MyApp.scala
Created July 23, 2016 10:34
finagle-01-utils
import com.twitter.app.App
object MyApp extends App {
def main() {
println("Hello, World")
}
}
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
namespace * net.gutefrage.temperature.thrift
/**
* temperature in celisus and timestamp in UTC milliseconds
*/
struct TemperatureDatum {
1: i32 celsius,
2: i64 timestamp
}
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] = ???
}
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
/**
package net.gutefrage
import com.twitter.finagle.Dtab
/**
* Holds different delegation tables
*/
object Dtabs {
def init(): Unit = {
// 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")
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
/**