Skip to content

Instantly share code, notes, and snippets.

View mushkevych's full-sized avatar

Dan Mushkevych mushkevych

  • Portland, OR, USA
View GitHub Profile
@mushkevych
mushkevych / example.mdal
Last active April 23, 2018 17:15
mdal example
base_model = LOAD "https://github.com/tensorflow/models/tree/master/official/resnet"
my_model = EXTEND base_model REUSE 5 LAYERS
TRAIN my_model WITH "dfs://mycompany.com/datasets/mymodel"
input = INPUT "pubsub://subscriptions/myproject/raw-feed" IN FORMAT json SCALE FOR my_model
output = OUTPUT "pubsub://publishers/myproject/prognosis" IN FORMAT json
EXECUTE my_model ON input INTO output
@mushkevych
mushkevych / data_repo.yaml
Last active November 2, 2016 03:44
sdpl_snippets
!DataRepository
db: mydb
host: host.the_company.xyz
kwargs: {}
name: repo_a
password: the_password
port: '6789'
user: the_user
@mushkevych
mushkevych / EventLoggerTx.java
Last active August 29, 2015 13:56
CSV with Log4j2
import org.apache.logging.log4j.EventLogger;
import org.apache.logging.log4j.message.StructuredDataMessage;
import java.util.ArrayList;
import java.util.List;
/**
* @author Bohdan Mushkevych
* wraps Class holds List<StructuredDataMessage> and flushes it to the EventLogger
*/
@mushkevych
mushkevych / Dockerfile
Last active December 30, 2015 07:39
Docker CDH 4.5
FROM ubuntu:precise
MAINTAINER Bohdan Mushkevych
# Installing Oracle JDK
RUN apt-get -y install python-software-properties ;\
add-apt-repository ppa:webupd8team/java ;\
apt-get update && apt-get -y upgrade ;\
echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections ;\
apt-get -y install oracle-java7-installer && apt-get clean ;\
update-alternatives --display java ;\
#!/bin/sh
# Variables
USER="admin"
PASS="password"
# Assert Root User
SCRIPTUSER=`whoami`
if [ "$SCRIPTUSER" != "root" ]
then
@mushkevych
mushkevych / common.json
Last active December 21, 2015 07:38
Puppet + Hiera + Jenkins Gist
{
"ntp::restrict" : true,
"ntp::autoupdate" : true,
"ntp::enable" : true,
"ntp::servers" : [
"0.centos.pool.ntp.org iburst",
"1.centos.pool.ntp.org iburst",
"2.centos.pool.ntp.org iburst"
]
}
@mushkevych
mushkevych / ordered_set.py
Last active December 20, 2015 07:19
OrderedSet
from collections import OrderedDict
class OrderedSet(OrderedDict):
def pop(self):
""" Returns and removes last element of the set """
if not self:
raise KeyError('dictionary is empty')
key = next(reversed(self))
@mushkevych
mushkevych / Grouping.java
Last active December 10, 2015 23:09
SingleColumnValueFilter example
public class Grouping {
@HRowKey(components = {
@HFieldComponent(name = Constants.TIMEPERIOD, length = Bytes.SIZEOF_INT, type = Integer.class),
@HFieldComponent(name = Constants.CATEGORY, length = Constants.LENGTH_CATEGORY_NAME, type = String.class)
})
public byte[] key;
/**
* format of the storage:
* {product_id : {
@mushkevych
mushkevych / Example.java
Created June 12, 2012 17:24
Surus blog examples
public class Example {
@HRowKey
public byte[] key;
@HProperty(family = "stat", identifier = "number_of_users")
public long numberOfUsers;
@HMapProperty(family = "stat", identifier = "months", keyType = String.class, valueType = Integer.class)
public Map<String, Integer> months = new HashMap<String, Integer>();
@mushkevych
mushkevych / mbean_example.py
Created June 11, 2012 19:07
Python MX illustration example
class MBeanExample(object):
def __init__(self):
self.property_1 = 'this is'
self.property_2 = 'example'
def start_mx(self):
""" import MX module (which has back-reference import to self) and start it """
from mx.mx import MX
self.mx = MX(self)
self.mx.start_mx_thread()