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 java.io.{IOException, ObjectOutputStream} | |
import scala.language.existentials | |
import scala.reflect.ClassTag | |
import org.apache.spark._ | |
import org.apache.spark.rdd.RDD | |
case class GroupedRDDPartition( |
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 scala.collection.mutable.Map | |
import org.apache.spark.{Accumulator, AccumulatorParam, SparkContext} | |
import org.apache.spark.scheduler.{SparkListenerStageCompleted, SparkListener} | |
import org.apache.spark.SparkContext._ | |
/** | |
* just print out the values for all accumulators from the stage. | |
* you will only get updates from *named* accumulators, though |
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 scala.concurrent.{Future, Promise} | |
import scala.concurrent.duration.{Duration, FiniteDuration} | |
import scala.concurrent.{Await, Promise} | |
import scala.util.{Failure, Success} | |
import scala.concurrent.ExecutionContext.Implicits.global | |
def performSequentially[A](items: Seq[A])(f: A => Future[Unit]): Future[Unit] = { | |
items.headOption match { | |
case Some(nextItem) => |
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
case class TestTime(suite: String, test: String, time: Int) | |
def parse(input: Iterator[String]): Seq[TestTime] = { | |
val TimingPattern = """(.*)\(((\d+) seconds?, )?(.*) milliseconds?\)""".r | |
val x = input.filter{line => line.startsWith("[info]") && !line.contains("!!! IGNORED !!!") && !line.startsWith("[info] +")}.map{_.substring("[info] ".length)} | |
var suiteName: String = null | |
var result = IndexedSeq[TestTime]() | |
while(x.hasNext) { | |
val line = x.next | |
if(line.endsWith(":")) |
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
logfile screenlogs/log.%n | |
deflog on | |
defscrollback 10000 | |
screen 1 | |
#other settings | |
hardstatus alwayslastline | |
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]' | |
vbell off | |
autodetach on | |
#Binds |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
... | |
// define your projects, with a custom "settings" | |
lazy val common = Project( | |
id = "common", | |
base = file("common"), | |
settings = baseSettings ++ Seq( | |
libraryDependencies ++= commonLibraryDependencies | |
) | |
) |
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
## this should get loaded by your ~/.Rprofile | |
## either just stick all these definitions right in ~/.Rprofile, or | |
## have ~/.Rprofile source this file, etc. | |
source.dirs <- c( | |
## add any "base" locations here. this is like a "classpath" in java | |
## my default is c("~/myRUtils/src","~/companyRUtils/src","~/publicRUtils"), | |
## but you can use whatever you like | |
paste(Sys.getenv("HOME"),"myRUtils","src", sep="/"), | |
paste(Sys.getenv("HOME"),"companyRUtils","src", sep="/"), |
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
alpha = 0.8 | |
z <- 1.28 | |
normal.theta.conf <- function(x, n) { | |
# normal approximation to a binomial. Generally agreed to be horrible | |
phat <- x / n | |
t <- z * sqrt(phat * (1 - phat)) / sqrt(n) | |
c(max(0,phat - t), min(1, phat + t)) | |
} |
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
➜ tmp javap -c -private TaggedTypes$ | |
Compiled from "TaggedTypes.scala" | |
public final class TaggedTypes$ { | |
public static final TaggedTypes$ MODULE$; | |
public static {}; | |
Code: | |
0: new #2 // class TaggedTypes$ | |
3: invokespecial #12 // Method "<init>":()V | |
6: return |