Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Jakub Liska l15k4

🎯
Focusing
  • Globalwebindex
  • Prague, Czech Republic
View GitHub Profile
View wercker.yml
box: globalwebindex/busybox-sbt
services:
- globalwebindex/busybox-es-test
- globalwebindex/ftp-test
build:
steps:
- script:
name: sbt
View Dockerfile
FROM frolvlad/alpine-oraclejdk8
MAINTAINER Jakub Liska liska.jakub@gmail.com
ENV SCALA_VERSION 2.11.7
ENV SCALA_HOME=/opt/scala-$SCALA_VERSION
ENV PATH=$PATH:$SCALA_HOME/bin
RUN apk --update add bash curl
RUN mkdir /opt && curl -jLks http://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz | gunzip -c - | tar -xf - -C /opt
View Dockerfile
FROM gwiq/scala
MAINTAINER Jakub Liska liska.jakub@gmail.com
ENV SBT_VERSION 0.13.9
ENV PATH=$PATH:/opt/sbt
RUN apk --update add curl bash
RUN mkdir /opt/sbt
ADD sbt /opt/sbt/
View log-entries@.service
[Unit]
Description=Log Entries
After=docker.service
[Service]
Restart=always
RestartSec=1m
TimeoutStartSec=0
KillMode=none
View ParallelMerge.scala
import akka.stream._
import akka.stream.scaladsl.FlexiMerge
import akka.stream.scaladsl.FlexiMerge.{Read, ReadAll, MergeLogic}
import scala.collection.{immutable, mutable}
class ParallelMergeLogic[A](remainingInlets: mutable.Set[Inlet[A]]) extends MergeLogic[immutable.Seq[A]] {
override def initialState = State(ReadAll(remainingInlets.toIndexedSeq)) {
View BypassMergeTestSuite.scala
import akka.stream.SourceShape
import akka.stream.scaladsl.{GraphDSL, Sink, Source}
import akka.stream.testkit.TestSubscriber
class BypassMergeTestSuite extends AkkaSuite {
import scala.language.implicitConversions
def assertBypassWorks[O, B](output: List[O], bypassed: List[B])(launch: TestSubscriber.ManualProbe[O] => Unit) = {
val source = Source.fromGraph(
GraphDSL.create() { implicit b =>
View BypassingMerge.scala
import akka.stream.scaladsl.FlexiMerge.{ReadAny, MergeLogic}
import akka.stream.{Attributes, FanInShape2}
import akka.stream.scaladsl.FlexiMerge
class BypassingMerge[A, B] extends FlexiMerge[A, FanInShape2[A, B, A]](new FanInShape2("BMerge"), Attributes.name("BMerge")) {
def createMergeLogic(p: PortT): MergeLogic[A] = new MergeLogic[A] {
override def initialState =
State[Any](ReadAny(p)) { (ctx, input, element) =>
if (input eq p.in0)
View NeverThreadSafe.scala
def generateTimeField(format: SimpleDateFormat)(i: Int) = do-stuff-with-thread-unsafe-format
val curriedF = generateTimeField(new SimpleDateFormat("foo"))_
List(1,2,3,4).par.map(curriedF)
View gist:6d22adc2da75ecd0b4b7
2016-01-20 21:20:08,018 DEBG 'druid-indexing-service' stderr output:
com.google.inject.CreationException: Guice creation errors:
1) No implementation for java.util.concurrent.ScheduledExecutorService was bound.
while locating java.util.concurrent.ScheduledExecutorService
for parameter 9 at io.druid.indexing.overlord.RemoteTaskRunnerFactory.<init>(RemoteTaskRunnerFactory.java:72)
at io.druid.cli.CliOverlord$1.configureRunners(CliOverlord.java:201)
2) No implementation for java.util.concurrent.ScheduledExecutorService was bound.
while locating java.util.concurrent.ScheduledExecutorService
View foo.json
{
"type" : "index",
"spec" : {
"dataSchema" : {
"dataSource" : "foo",
"parser" : {
"type" : "string",
"parseSpec":{
"format" : "tsv",
"timestampSpec" : {