This file contains hidden or 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
| 278270 |
This file contains hidden or 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 hidden or 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.setup.syslog.plain; | |
| import javafx.util.Pair; | |
| import org.joda.time.DateTime; | |
| import org.joda.time.format.*; | |
| import scala.collection.mutable.ArrayBuilder; | |
| import java.io.*; | |
| import java.nio.charset.Charset; | |
| import java.util.*; | |
| import java.util.regex.Matcher; |
This file contains hidden or 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 sbt._ | |
| import Keys._ | |
| object MyBuild extends Build { | |
| lazy val copyDependencies = TaskKey[Unit]("copy-dependencies") | |
| def copyDepTask = copyDependencies <<= (update, crossTarget, scalaVersion) map { | |
| (updateReport, out, scalaVer) => | |
| updateReport.allFiles foreach { srcPath => |
This file contains hidden or 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 PairsNews { | |
| type RankerPairs = DList[(Long, Iterable[(Long, Long))] | |
| def main(a: Array[String]) = withHadoopArgs(a) { case args => | |
| case object o extends ScallopConf(args) { | |
| val date = opt[String]("date", descr = "generate pairs for new regs after that date") | |
| val allRankerPairsBase = opt[String]("base", descr = "directory where all ranker-pairs are stored, per day", | |
| default = Some("fatpipe/generated")) |
This file contains hidden or 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 readUserScores(fileName: String): List[UserScore] = { | |
| val serocs = ((Nil: List[UserScore]) /: | |
| io.Source.fromFile(fileName).getLines() | |
| // .map(_.split("\t")).map(array2Pair(_)) | |
| // .map(((x:String) => x.split("\t")) andThen array2Pair) | |
| // .map(((_:String).split("\t")) andThen array2Pair) | |
| .map( array2Pair _ compose (_.split("\t"))) | |
| ) { case (l, e) => e :: l } | |
| serocs.reverse |
This file contains hidden or 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 array2Pair(a: Array[String]): UserScore = { | |
| if (a.size != 2) throw new NotArray2 | |
| (a(0).toLong, a(1).toDouble) | |
| } | |
| io.Source.fromFile(fileName).getLines().map(_.split("\t")).map(array2Pair(_)) |
This file contains hidden or 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
| ©2012 Viktor Klang | |
| object Actor { | |
| import java.util.concurrent.{ConcurrentLinkedQueue, Executor} | |
| import java.util.concurrent.atomic.{AtomicBoolean} | |
| type Behavior = Any => Effect | |
| sealed trait Effect { def getOrElse(old: Behavior): Behavior } | |
| case object Stay extends Effect { def getOrElse(old: Behavior): Behavior = old } | |
| case class Become(like: Behavior) extends Effect { def getOrElse(old: Behavior): Behavior = like } |
This file contains hidden or 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 putStat[T](id: String, k: String, v: T, coll: MongoCollection = ms): Unit = { | |
| Console.err.println("putting mongo stat: _id->%s, %s->%s".format(id,k,v)) | |
| val newVal = Map(k -> v) | |
| coll.findOneByID(id) match { | |
| case Some(obj) => coll.update(obj, obj + (k -> v)) | |
| case _ => coll.insert(MongoDBObject("_id"->id, k->v)) | |
| } | |
| } |
This file contains hidden or 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 soiBy1: DList[Edge] = | |
| if (o.fromKey()) { | |
| val soiByK: DList[String] = convertKeyFromSequenceFile(o.soiByFile()) | |
| soiByK map { k => val c = k.split(","); (c(4).toLong, c(1).toLong) } | |
| } | |
| else fromDelimitedTextFile(o.soiByFile(),o.sep) { | |
| case Long(u) :: Long(v) :: _ => (u,v) | |
| } | |
| val soiBy2: DList[Edge] = if (o.flip()) soiBy1 ++ soiBy1.map(_.swap) else soiBy1 |
NewerOlder