Skip to content

Instantly share code, notes, and snippets.

View DmitryBe's full-sized avatar

Dmitry B DmitryBe

View GitHub Profile
@DmitryBe
DmitryBe / hotkeys.md
Last active May 27, 2022 14:21
vscode

CMD+b open/close left panel

Ctrl + - [+ shit] go back/forward

Ctrl + CMD + left [right] split editor

CMD + T open search panel

CMD + down open file from explorer

@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"
@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 / apply-patch.sh
Created April 10, 2018 10:23
kubernetescreate-labels-patch.sh
# requried env
# KUBE_NAMESPACE
# patch.json
KUBE_TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
if [ -z "$KUBE_TOKEN" ]; then
echo "Error: KUBE_TOKEN is empty"
exit 1
fi
@DmitryBe
DmitryBe / example.py
Created March 12, 2018 08:06
Run python notebook function from another notebook
import os
import io, os, sys, types
from IPython import get_ipython
from nbformat import read
from IPython.core.interactiveshell import InteractiveShell
class NotebookLoader(object):
"""Module Loader for Jupyter Notebooks"""
def __init__(self, path=None):
self.shell = InteractiveShell.instance()
@DmitryBe
DmitryBe / aws2fa.sh
Created October 4, 2017 03:28
aws tools
#!/bin/bash
if [[ -z ${MFA_DEVICE} ]]; then echo 'MFA_DEVICE is required'; exit -1; else echo 'MFA_DEVICE found'; fi
if [[ -z ${AWS_ACCESS_KEY_ID} ]]; then echo 'AWS_ACCESS_KEY_ID is required'; exit -1; else echo 'AWS_ACCESS_KEY_ID found'; fi
if [[ -z ${AWS_SECRET_ACCESS_KEY} ]]; then echo 'AWS_SECRET_ACCESS_KEY is required'; exit -1; else echo 'AWS_SECRET_ACCESS_KEY found'; fi
function aws_auth {
CODE=$1
RESPONSE=$2
unset AWS_SESSION_TOKEN
@DmitryBe
DmitryBe / config_utils.py
Created August 15, 2017 06:24
Load python config from json. Replace env vars templates with values
def load_app_config(config_file_path):
'''
load json config file, example:
{
"query": {
"port": 8000,
"env1": "${ENV1:-default_value}",
"env2": "${ENV2:-12}"
}
}
@DmitryBe
DmitryBe / avroReadExample.scala
Created July 28, 2017 09:02
Read AVRO from S3
// avro schema path
val avroSchemaPath = "path-to/avro-schema.avsc"
val avroSchemaStr= scala.io.Source.fromFile(avroSchemaPath).mkString
val avroSchemaParser = new Schema.Parser
val avroSchema = avroSchemaParser.parse(avroSchemaStr)
// create avro generic record reader
val avroGenericRecordReader = new GenericDatumReader[GenericRecord](avroSchema)
@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 / DataParsing.scala
Created April 28, 2017 04:07
Parse NY Taxi data with spark
// parsed taxi row
case class Trip(
license: String,
pickupTime: Long,
dropoffTime: Long,
pickupX: Double,
pickupY: Double,
dropoffX: Double,
dropoffY: Double)