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
git format-patch HEAD~X --stdout > patch | |
git apply --stat patch | |
git apply --reject --whitespace=fix patch |
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 spark.implicits._ | |
import org.apache.spark.sql.functions.udf | |
import org.apache.spark.sql._ | |
import org.apache.spark.sql.functions._ | |
import org.apache.spark.sql.execution.debug._ | |
val u = udf((a: Int) => a) | |
val df = spark.sparkContext.parallelize(Seq(0)).toDF("0") | |
val res = (1 until 20).foldLeft(df) { case (d, i) => |
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 rs | |
import scala.language.higherKinds | |
import matryoshka.data._ | |
import matryoshka.implicits._ | |
import scalaz._, Scalaz._ | |
trait Expr[A] | |
case class NumLit[A](value: Int) extends Expr[A] |
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.Random | |
import java.security.SecureRandom | |
import java.util.concurrent.atomic.AtomicLong | |
import org.joda.time.DateTimeUtils | |
/** | |
* 64 bit unique id generator | |
* Features: | |
* 1. generate ascending or descending ids | |
* 2. 64 bit id consists of: |
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
files: | |
"/etc/init/eb-docker-iptables.conf": | |
mode: "000644" | |
content: | | |
description "Elastic Beanstalk Default Docker Container Iptables" | |
author "Matthew Tovbin <mtovbin@salesforce.com>" | |
start on started docker | |
stop on stopping docker |
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
task classpath << { | |
description 'Print project classpath.' | |
println sourceSets.main.runtimeClasspath.asPath | |
} |
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
1. Install all the required libraries: | |
sudo apt-get update && sudo apt-get -y install \ | |
unzip \ | |
perl \ | |
wget \ | |
curl \ | |
make \ | |
ncftp \ | |
liburi-perl \ |
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
var AMP = 0.5; // amplitude | |
var len = 15; // seconds | |
e = new webkitAudioContext(); | |
var source = e.createBufferSource(); | |
var SR = e.sampleRate; | |
source.buffer = e.createBuffer(1, len * SR, SR); | |
var dat = source.buffer.getChannelData(0); | |
for (var i = 0; i < len * SR; i++) { | |
dat[i] = AMP * (Math.random() * 2 - 1); | |
} |
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 org="org.apache.zookeeper" name="zookeeper" rev="3.4.5"> | |
<exclude org="log4j" module="log4j"/> | |
<exclude org="org.slf4j" module="slf4j-log4j12"/> | |
<exclude org="jline" module="jline"/> | |
</dependency> |
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
// Excercies from chapter 5: Strictness and laziness | |
def foldRight[A,B](z: => B)(s: Stream[A])(f: (A, => B) => B): B = | |
s match { | |
case hd #:: tail => f(hd, foldRight(z)(tail)(f)) | |
case _ => z | |
} | |
def exists[A](s: Stream[A])(p: A => Boolean): Boolean = | |
foldRight(false)(s)((x,a) => if (p(x)) true else a) |