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
[program:nsqlookupd] | |
command=/usr/local/nsq/bin/nsqlookupd --http-address="10.36.206.254:4161" --tcp-address="10.36.206.254:4160" | |
process_name=%(program_name)s | |
numprocs=1 | |
directory=/usr/local/nsq | |
user=ubuntu | |
stdout_logfile=/var/log/nsq/nsqlookupd.log | |
stdout_logfile_maxbytes=50MB | |
stdout_logfile_backups=5 | |
redirect_stderr=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
case class MC(ids: List[Int], matchType: String = "one") | |
def weight(mcType: String) = 1 | |
val values = List(MC(List(1, 2, 3, 4, 5)), MC(List(3, 4, 5, 3, 6)), MC(List(3, 1, 5, 2, 3))) | |
val winners = values.foldLeft(collection.mutable.Map.empty[Int, Int])({ (acc, mc) ⇒ | |
mc.ids foreach (id ⇒ acc.update(id, acc.getOrElse(id, 0) + weight(mc.matchType))) | |
acc | |
}).foldLeft(collection.immutable.TreeMap.empty[Int, Int]) { case (best, (id, weight)) ⇒ |
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
it should "test" in { | |
// var prev = 0 | |
// var max = List.empty[Int] | |
// val n = ListBuffer.empty[Int] | |
val l = List(5, 1, 4, 2, 3, 3, 8) | |
var tail = l | |
val res = ListBuffer.empty[List[Int]] |
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
#!/bin/bash | |
for i in $(seq $1 300000 $2) | |
do | |
echo "$i" | |
/home/ubuntu/export-to-csv.sh $i 300000 | |
echo "curl $i" | |
curl -s -XPOST $3:9200/_bulk --data-binary @/mnt/vk-csv/vk-$i.out > /dev/null | |
done |
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.util.{Success, Failure} | |
import akka.actor._ | |
import spray.client.pipelining._ | |
import spray.http._ | |
object Test extends App { | |
implicit val system = ActorSystem() |
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.util.parsing.combinator._ | |
object JSON extends JavaTokenParsers { | |
val obj: Parser[Map[String, Any]] = | |
"{" ~> repsep(member, ",") <~ "}" ^^ (Map() ++ _) | |
val arr: Parser[List[Any]] = | |
"[" ~> repsep(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
package com.libitec.sce.util.amqp | |
import com.rabbitmq.client._ | |
import com.rabbitmq.client.AMQP.BasicProperties | |
import com.typesafe.config.Config | |
/** | |
* Simple amqp-client | |
*/ |
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
> dependency-graph | |
[info] Updating {file:/private/var/www/prismatic-feed/}default-c5fd1b... | |
[info] Resolving ch.qos.logback#logback-core;1.0.10 ... | |
[info] Done updating. | |
[info] ru.kulikovd:prismatic-feed_2.10:0.0.1-SNAPSHOT [S] | |
[info] +-com.typesafe.akka:akka-actor_2.10:2.1.2 [S] | |
[info] | +-com.typesafe:config:1.0.0 | |
[info] | | |
[info] +-com.typesafe.akka:akka-slf4j_2.10:2.1.2 [S] | |
[info] | +-com.typesafe.akka:akka-actor_2.10:2.1.2 [S] |
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 com.libitec.sce.util.transaction | |
import akka.actor.ActorRef | |
import akka.dispatch.{Promise, Future, Await} | |
import akka.pattern.AskTimeoutException | |
import akka.pattern.ask | |
import akka.util.duration._ | |
import akka.util.{Duration, Timeout} | |
import scalaz._ | |
import Scalaz._ |
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
trait EventsourcedState { | |
type Trans = TransactionMember | |
private val isReplaing = false | |
implicit protected def toEntityWithId(obj: Any) = new EntityWithId(obj) | |
private class EntityWithId(obj: Any) { | |
def id[ID] = |