Skip to content

Instantly share code, notes, and snippets.

// These two lines are only for code completion in IDEA,
// don't paste them into spark-shell
val spark: org.apache.spark.sql.SparkSession
import spark.implicits._
import scala.util.Random
@transient val sc = spark.sparkContext
// # of rows 1M-10M. Running time is quadratic,
data.table lubridate ggplot2 h2o lift plotly party Hmisc caret caretEnsemble markdown knitr RColorBrewer revealjs rmarkdown boot corrplot dplyr forecast foreign ggplot2 ggthemes MASS Matrix matrixStats mclust moments plotrix plotROC ROCR plyr psych reshape2 rlm sqldf stringr tidyr Weighted.Desc.Stat xgboost elasticnet glmnet party Hmisc
@SlavikBaranov
SlavikBaranov / white-helv.css
Created November 23, 2016 16:08
Helvetica theme for RevealJS presentation
/**
* White theme for reveal.js. This is the opposite of the 'black' theme.
*
* By Hakim El Hattab, http://hakim.se
*/
section.has-dark-background, section.has-dark-background h1, section.has-dark-background h2, section.has-dark-background h3, section.has-dark-background h4, section.has-dark-background h5, section.has-dark-background h6 {
color: #fff; }
/*********************************************
* GLOBAL STYLES
// These two lines are only for code completion in IDEA,
// don't paste them into spark-shell
val spark: org.apache.spark.sql.SparkSession
import spark.implicits._
import scala.util.Random
@transient val sc = spark.sparkContext
// # of rows 1M-10M. Running time is quadratic,
// Requires "com.twitter" %% "util-core" % "6.34.0"
import com.twitter.concurrent.AsyncStream
import com.twitter.util.{Await, Future}
object TestStream extends App {
def foo(read: () => Future[String], write: String => Future[Unit]): Future[Unit] = {
def stream: AsyncStream[String] = AsyncStream.fromFuture(read()).flatMap(_ +:: stream)
/*
1. Download spark-csv & apache commons-csv
http://mvnrepository.com/artifact/com.databricks/spark-csv_2.10/1.3.0
http://mvnrepository.com/artifact/org.apache.commons/commons-csv/1.2
2. Run spark-shell with command:
spark-shell --jars /<path to>/spark-csv_2.10-1.3.0.jar,/<path to>/commons-csv-1.2.jar
*/