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 scala.concurrent._ | |
import scala.concurrent.duration._ | |
import scala.concurrent.ExecutionContext.Implicits.global | |
import scala.util.Random | |
import java.util.{Timer, TimerTask} | |
object Util { | |
sealed trait BaseResponse | |
case class Response1(res: Int) extends BaseResponse | |
case class Response2(res: String) extends BaseResponse |
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 scala.collection.mutable | |
/** | |
* Bounded priority queue trait that is intended to be mixed into instances of | |
* scala.collection.mutable.PriorityQueue. By default PriorityQueue instances in | |
* Scala are unbounded. This trait modifies the original PriorityQueue's | |
* enqueue methods such that we only retain the top K elements. | |
* The top K elements are defined by an implicit Ordering[A]. | |
* @author Ryan LeCompte (lecompte@gmail.com) | |
*/ |
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 mapreduce | |
/** | |
* This is an attempt to find a minimal set of type classes that describe the map-reduce programming model | |
* (the underlying model of Google map/reduce, Hadoop, Spark and others) | |
* The idea is to have: | |
* 1) lawful types that fully constrain correctness | |
* 2) a minimal set of laws (i.e. we can't remove any laws, | |
* 3) able to fully express existing map/reduce in terms of these types | |
* |
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 kafka.admin.CreateTopicCommand; | |
import kafka.producer.KeyedMessage; | |
import kafka.producer.Producer; | |
import kafka.producer.ProducerConfig; | |
import kafka.server.KafkaConfig; | |
import kafka.server.KafkaServer; | |
import kafka.utils.*; | |
import kafka.utils.TestUtils; | |
import kafka.utils.TestZKUtils; | |
import kafka.zk.EmbeddedZookeeper; |
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 scala.language.experimental.macros | |
import scala.reflect.macros.whitebox | |
class FreeMacros(val c: whitebox.Context) { | |
import c.universe._ | |
def smartName(name: String): String = ( | |
name.toList match { | |
case h :: t => h.toLower :: t | |
case Nil => Nil |
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 org.deeplearning4j.learn | |
import java.util.Arrays | |
import org.nd4j.api.linalg.DSL._ | |
import org.nd4j.linalg.api.ndarray.INDArray | |
import org.nd4j.linalg.factory.Nd4j | |
import org.nd4j.linalg.indexing.{NDArrayIndex, BooleanIndexing} | |
import org.nd4j.linalg.indexing.conditions.Conditions | |
import org.nd4j.linalg.indexing.functions.Value |
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
> runMain ammonite.repl.Repl | |
[info] Running ammonite.repl.Repl | |
Loading Ammonite Repl... | |
@ load.ivy("com.chuusai" %% "shapeless" % "2.1.0") | |
@ import shapeless._ | |
import shapeless._ | |
@ 1 :: "lol" :: List(1, 2, 3) :: HNil |
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
"""A stripped-down MLP example, using Theano. | |
Based on the tutorial here: http://deeplearning.net/tutorial/mlp.html | |
This example trims away some complexities, and makes it easier to see how Theano works. | |
Design changes: | |
* Model compiled in a distinct function, so that symbolic variables are not in run-time scope. | |
* No classes. Network shown by chained function calls. |
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
/** | |
* D Holbrook | |
* | |
* Code Club: PO1 | |
* | |
* (*) Define a binary tree data structure and related fundamental operations. | |
* | |
* Use whichever language features are the best fit (this will depend on the language you have selected). The following operations should be supported: | |
* | |
* Constructors |
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 akkahttptest | |
import akka.http.Http | |
import akka.stream.ActorFlowMaterializer | |
import akka.actor.ActorSystem | |
import akka.stream.scaladsl.{Sink, Source} | |
import akka.http.model._ | |
object TestClient extends App { |
OlderNewer