View udfs.scala
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) =>
View RecursionSchemes.scala
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]
View 01-iptables.config
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
View build.gradle
task classpath << {
description 'Print project classpath.'
println sourceSets.main.runtimeClasspath.asPath
}
View script.sh
cd /proc/<pid> && echo -n "Max open files=65535:65535" > limits
View FileAsyncIO.scala
import java.io.IOException
import java.nio.ByteBuffer
import java.nio.channels.{AsynchronousFileChannel, CompletionHandler}
import java.nio.file.Paths
import java.nio.file.StandardOpenOption._
import scala.concurrent.{ExecutionContext, Future, Promise}
import scala.util.Try
/**
View statsd_trap.py
import socket, select
s1 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s1.bind(('localhost', 8125))
s2 = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_UDP)
s2.bind(('localhost', 8125))
while True:
r, w, x = select.select([s1, s2], [], [])
for i in r:
print i, i.recvfrom(131072)
View .backupignore
.Spotlight-*/
.Trashes
/afs/*
/automount/*
/cores/*
/dev/*
/Network/*
/private/tmp/*
/private/var/run/*
/private/var/spool/postfix/*
View waves.js
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);
}
View Build.scala
<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>