Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@akkomar
akkomar / Dockerfile
Created January 14, 2017 08:12 — forked from qharlie/Dockerfile
FROM ubuntu:16.04
LABEL maintainer "Charlie"
LABEL com.nvidia.volumes.needed="nvidia_driver"
ENV DEBIAN_FRONTEND noninteractive
RUN NVIDIA_GPGKEY_SUM=d1be581509378368edeec8c1eb2958702feedf3bc3d17011adbf24efacce4ab5 && \
NVIDIA_GPGKEY_FPR=ae09fe4bbd223a84b2ccfce3f60f4b3d7fa2af80 && \
apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub && \
apt-key adv --export --no-emit-version -a $NVIDIA_GPGKEY_FPR | tail -n +5 > cudasign.pub && \
@akkomar
akkomar / zeppelin.md
Last active October 13, 2016 12:35
Building Zeppelin

Build:

dev/change_scala_version.sh 2.11

mvn clean package -Pspark-2.0 -Phadoop-2.6 -Pyarn -Pscala-2.11 -DskipTests
# List topics
bin/kafka-topics.sh --list --zookeeper zookeeper_host:2181
# Create topic
bin/kafka-topics.sh --create --zookeeper zookeeper_host:2181 --replication-factor 1 --partitions 1 --topic test
# Start consumer (v0.9)
#!/usr/bin/env python
import sys, os
input = sys.stdin.read()
oldrev, newrev, refname = input.rstrip().split(" ")
SUPER_USER_KEY_ID = 'key-ID'
user_key_id = os.environ['GL_ID']
@akkomar
akkomar / MergeFuturesOfLists.scala
Last active August 17, 2020 10:56
Merging sequence of Futures of Lists into one Future containing merged list
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._
import scala.concurrent.{Await, Future}
val futures: List[Future[List[Int]]] =
List.fill(10)(Future {
Thread.sleep(100)
List(1, 2, 3)
})
@akkomar
akkomar / binary_tree_map.scala
Created October 17, 2013 23:27
Binary tree concurrent map
import java.util.concurrent._
import scala.{Option, Some, None}
case class Node[T](val v: T, l: Option[Node[T]], r: Option[Node[T]]) {
def map[R](f: T => R): Node[R] = {
new Node(f(v), l.map(n => n.map(f)), r.map(n => n.map(f)))
}
def mapConcurrently[R](f: T => R): Node[R] = {
val poolSize = Runtime.getRuntime.availableProcessors()