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
def split[H, T <: HList](l: H :: T) = l.head |
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
/* | |
@daunnc, stackoverflow: http://stackoverflow.com/questions/20020967/transforming-matrix-format-scalding-solved | |
converts | |
1 2 3 | |
3 4 5 | |
6 7 8 | |
to |
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
/** | |
* Type class supporting access to the all elements of this `HList` for functions from type `U` ~(`U => V`). | |
* | |
* author of original HList Filter Alois Cochard | |
* | |
* @author Grigory Pomadchin | |
*/ | |
object am3 { | |
trait FuncFilter[L <: HList, U] extends DepFn1[L] { type Out <: HList } |
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
def hmacSha1(value: String, key: String) = { | |
// Get an hmac_sha1 key from the raw key bytes | |
val keyBytes = key.getBytes | |
val signingKey = new SecretKeySpec(keyBytes, "HmacSHA1") | |
// Get an hmac_sha1 Mac instance and initialize with the signing key | |
val mac = Mac.getInstance("HmacSHA1") | |
mac.init(signingKey) | |
// Compute the hmac on input data bytes |
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
#!/usr/bin/env bash | |
# | |
# Compile and install MongoDB with SSL support | |
# tested an works on Ubuntu 12.04 LTS x64 and Ubuntu 14.04 LTS x64 | |
# | |
set -e | |
set -u | |
set -o pipefail |
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
// val akkaV = "2.3.4-spark" | |
val akkaV = "2.2.3-shaded-protobuf" | |
val sprayV = "1.2.2" | |
val geotrellisV = "0.10.0-SNAPSHOT" | |
Seq( | |
"io.spray" % "spray-can" % sprayV excludeAll ExclusionRule("com.typesafe.akka"), | |
"io.spray" % "spray-routing" % sprayV excludeAll ExclusionRule("com.typesafe.akka"), | |
"io.spray" % "spray-caching" % sprayV excludeAll ExclusionRule("com.typesafe.akka"), | |
"io.spray" %% "spray-json" % "1.2.6" excludeAll ExclusionRule("com.typesafe.akka"), |
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
// val akkaV = "2.2.3-shaded-protobuf" | |
val akkaV = "2.3.4-spark" | |
val sprayV = "1.2.2" | |
Seq( | |
"io.spray" % "spray-can" % sprayV excludeAll ExclusionRule("com.typesafe.akka"), | |
"io.spray" % "spray-routing" % sprayV excludeAll ExclusionRule("com.typesafe.akka"), | |
"io.spray" % "spray-caching" % sprayV excludeAll ExclusionRule("com.typesafe.akka"), | |
"io.spray" %% "spray-json" % "1.2.6" excludeAll ExclusionRule("com.typesafe.akka"), | |
"org.spark-project.akka" %% "akka-actor" % akkaV, |
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
// Stackoverflow discussion: http://stackoverflow.com/questions/33541107/implement-product-type-in-scala-with-generic-update-function-working-on-its-part | |
// shapeless 2.2.5 | |
import shapeless._ | |
import ops.hlist._ | |
import ops.traversable._ | |
import shapeless.syntax.std._ | |
import shapeless.syntax.std.traversable._ | |
case class A(fieldA: String) |
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
// http://scastie.org/13093 | |
/*** | |
sbtPlugin := true | |
*/ | |
import sbt._ | |
import Keys._ | |
object BuildUtil { | |
private val localLibs = scala.util.Try(IO.read(file("local-libs.txt"))).map(_.split('\n').map(_.trim).toSet).getOrElse(Set()) |
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 annotations.template | |
import reflect.runtime.universe.TypeTag | |
case class SW(s: String) | |
case class IW(c: Int) | |
case class BW(d: Double) | |
case class PD(sw: SW, iw: IW, bw: BW) | |
@template((i: Int, s: String, d: Double) => PD(SW(s), IW(i), BW(d))) | |
object Test2 { |
OlderNewer