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
object Main extends App { | |
val jettyServer = new Server(8080) | |
/** Serve some HTML along side the Spray Servlet **/ | |
val htmlHandler = new ResourceHandler() | |
// here, my HTML files are in a 'web' folder under src/main/resources/web | |
htmlHandler.setResourceBase(ClassLoader.getSystemResource("web").toString()) | |
htmlHandler.setDirectoriesListed(true) |
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 java.util.concurrent.Callable; | |
import java.util.concurrent.ExecutionException; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.TimeUnit; | |
import com.google.common.cache.CacheBuilder; | |
import com.google.common.cache.CacheLoader; | |
import com.google.common.cache.LoadingCache; | |
import com.google.common.util.concurrent.ListenableFuture; |
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
class GuavaArrayListMultiMapFromToString { | |
static ArrayListMultimap<String, String> toArrayListMultimap(final String toString) | |
{ | |
final ArrayListMultimap<String, String> map = ArrayListMultimap.create(); | |
final Pattern pattern = Pattern.compile("\\w+=\\[.+?\\]"); | |
final Matcher matcher = pattern.matcher(data); | |
while(matcher.find()) | |
{ | |
final String group = matcher.group(); |
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 aws.playground | |
import aws.playground.AwsPipelineClusterManager._ | |
import com.amazonaws.regions.RegionUtils | |
import com.amazonaws.services.autoscaling.AmazonAutoScalingClient | |
import com.amazonaws.services.autoscaling.model.{CreateAutoScalingGroupRequest, CreateLaunchConfigurationRequest, DeleteAutoScalingGroupRequest, DeleteLaunchConfigurationRequest} | |
import com.amazonaws.services.ecs.AmazonECSClient | |
import com.amazonaws.services.ecs.model.{CreateClusterRequest, CreateClusterResult, DeleteClusterRequest, DeleteClusterResult} |
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 accessPoints = Seq(???) | |
def autoChannel(accessPoints: Seq[AccessPoint]): Channel = { | |
accessPoints.groupBy(_.channel) | |
.maxBy{ case (channel, aps) => aps.size } | |
._1 | |
} |
I hereby claim:
- I am kdrakon on github.
- I am kdrakon (https://keybase.io/kdrakon) on keybase.
- I have a public key whose fingerprint is 3696 F8F1 D728 6671 EBA2 97B8 5879 13B5 C5C6 51B7
To claim this, I am signing this object:
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 java.util.concurrent.atomic.AtomicInteger | |
import java.util.concurrent.{Executors, TimeUnit} | |
import akka.actor.{ActorSystem, Props} | |
import akka.routing.ConsistentHash | |
import akka.stream.actor._ | |
import akka.stream.scaladsl.{Flow, GraphDSL, RunnableGraph, Sink, Source} | |
import akka.stream.{ActorMaterializer, ClosedShape, ThrottleMode} | |
import com.kifi.franz.{MessageId, SQSMessage} |
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 org.apache.kafka.common.serialization.Deserializer; | |
import org.apache.kafka.common.serialization.Serde; | |
import org.apache.kafka.common.serialization.Serializer; | |
import java.util.Map; | |
import java.util.function.Function; | |
public class SerdeFunction<T> implements Serde<T> { | |
private final Function<T, byte[]> serializer; |
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.fasterxml.jackson.annotation.JsonAutoDetect; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
import com.fasterxml.jackson.databind.node.ObjectNode; | |
import org.apache.kafka.streams.kstream.ValueMapper; | |
import java.nio.charset.Charset; | |
public class JsonSerdeForAvroClasses<T> { | |
public static <T> JsonSerdeForAvroClasses<T> gen() { |
OlderNewer