Skip to content

Instantly share code, notes, and snippets.

View DmitryBe's full-sized avatar

Dmitry B DmitryBe

View GitHub Profile
@DmitryBe
DmitryBe / Retry.scala
Created August 4, 2016 13:28 — forked from Mortimerp9/Retry.scala
A retry implementation for Scala, a bit of explanations here: http://pierreandrews.net/posts/retry-fail-scala.html
import scala.concurrent.Await
import scala.concurrent.ExecutionContext
import scala.concurrent.Future
import scala.concurrent.blocking
import scala.concurrent.duration.Deadline
import scala.concurrent.duration.Duration
import scala.concurrent.duration.DurationInt
import scala.concurrent.duration.DurationLong
import scala.concurrent.future
import scala.concurrent.promise
@DmitryBe
DmitryBe / splitRange.md
Created April 5, 2017 00:41 — forked from asieira/splitRange.md
Scala - split Range (x to y, x until y) into similarly-sized sub-Ranges

This will only work with ranges with a step (by) of 1 so far, but is a simple solution to splitting a range into a given number of sub-ranges:

  def splitRange(r: Range, chunks: Int): Seq[Range] = {
    if (r.step != 1) 
      throw new IllegalArgumentException("Range must have step size equal to 1")
      
    val nchunks = scala.math.max(chunks, 1)
    val chunkSize = scala.math.max(r.length / nchunks, 1)
    val starts = r.by(chunkSize).take(nchunks)
    val ends = starts.map(_ - 1).drop(1) :+ r.end
@DmitryBe
DmitryBe / CustomIterator.scala
Created April 5, 2017 00:41 — forked from frgomes/CustomIterator.scala
Scala - Custom Iterator
import scala.collection.AbstractIterator
class CustomIterator[T,U](it: Iterator[T])(f: (T => U)) extends AbstractIterator[U] {
override def hasNext: Boolean = it.hasNext
override def next(): U = f(it.next)
}
private def resourceAsStream(resource: String): Iterator[(String, String)] = {
val stream : java.io.InputStream = getClass.getResourceAsStream(resource)
val it = scala.io.Source.fromInputStream( stream ).getLines
@DmitryBe
DmitryBe / nes.py
Created April 5, 2017 01:01 — forked from karpathy/nes.py
Natural Evolution Strategies (NES) toy example that optimizes a quadratic function
"""
A bare bones examples of optimizing a black-box function (f) using
Natural Evolution Strategies (NES), where the parameter distribution is a
gaussian of fixed standard deviation.
"""
import numpy as np
np.random.seed(0)
# the function we want to optimize
@DmitryBe
DmitryBe / .inputrc
Created July 17, 2017 09:34 — forked from oreh/.inputrc
"\e[A": history-search-backward
"\e[B": history-search-forward
set show-all-if-ambiguous on
set completion-ignore-case on
set bell-style none
@DmitryBe
DmitryBe / Setting up a GPU Enabled Kubernetes for Deep Learning.md
Created April 26, 2018 10:59
Setting up a GPU Enabled Kubernetes for Deep Learning

Setting up a GPU Enabled Kubernetes for Deep Learning

Kubernetes spread like a wildfire in 2017, No kidding! Here are some numbers from Scott's post:

“For companies with more than 5000 employees, Kubernetes is used by 48% and the primary orchestration tool for 33%.”

“79% of the sample chose Docker as their primary container technology.”

Riding the wave of Kubernetes, 2017 was a particular fun year for Infrastructure/DevOps folks. Finally we have some cool tools to play with after years of darkness. We started thinking what we could do with such paradigm shift. We tried to optimize the developer velocity with Jenkins and Helm Chart and many other more to come :D

One thing I hold dear in my heart is democratizing Kubernetes for Data team. It's a well known fact that today's Data teams have to muster an array of bleeding edge technologies in or

@DmitryBe
DmitryBe / aws_create_site.yml
Created August 29, 2018 16:57 — forked from ruzickap/aws_create_site.yml
Ansible playbook which creates instances and tag volumes
---
- name: Create Instance in AWS
hosts: localhost
connection: local
gather_facts: false
vars:
aws_access_key: "xxxxxx"
aws_secret_key: "xxxxxx"
security_token: "xxxxxx"