Skip to content

Instantly share code, notes, and snippets.

sudo docker -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock -d &
@gleeb
gleeb / gist:37a38edd9e945865cc16
Created January 6, 2016 08:08
aws ubuntu cfn tools
apt-get update
apt-get install -y python-setuptools
apt-get install -y python-pip
apt-get install -y python-dev
apt-get install -y libffi-dev
apt-get install -y libssl-dev
apt-get install -y build-essential
pip install requests[security]
mkdir aws-cfn-bootstrap-latest
curl https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz | tar xz -C aws-cfn-bootstrap-latest --strip-components 1
@gleeb
gleeb / gist:0ded6186594cda4aedf47bc45dc41d88
Created May 26, 2016 12:18
slick mysql autogenerate schema sbt task
lazy val slickGenerate = taskKey[Seq[File]]("slick code generation from an existing database")
slickGenerate := {
import java.io.File
val dbName = ""
val userName = ""
val password = ""
val url = s"jdbc:mysql://localhost:3306/$dbName" // adapt as necessary to your system
val jdbcDriver = "com.mysql.jdbc.Driver" // replace if not MySQL
val slickDriver = "slick.driver.MySQLDriver" // replace if not MySQL
@gleeb
gleeb / CircleRun.sh
Created November 21, 2017 12:38
CircleCI build without commit
if [ $# -ne 4 ]; then
echo "usage: circle-build.sh <repository> <branch> <commit> <config-yml>"
exit 1;
fi
ORG=VATBox
API_TOKEN="42d8a7e3cd1ba3a4ae45eb38ec2e59bce74fb278"
REPO="$1"
BRANCH="$2"
@gleeb
gleeb / sklearn-titanic-train-job.py
Created August 7, 2022 10:58
sagemaker train and serve titanic
import argparse
import os
import numpy as np
import pandas as pd
import boto3
from io import StringIO
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score
@gleeb
gleeb / titanic-train-invoke-notebook.ipynb
Last active August 7, 2022 11:08
titanic-train-invoke-notebook.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gleeb
gleeb / create_group.py
Created August 7, 2022 17:46
Sagemaker reate package group
import os
import sagemaker
import boto3
iam_client = boto3.client('iam')
role = iam_client.get_role(RoleName='AmazonSageMaker-ExecutionRole-xyz')['Role']['Arn']
sm_client = boto3.client('sagemaker', region_name="us-east-1")
model_package_group_name = "Titanic-survival"
model_package_group_input_dict = {
@gleeb
gleeb / regiter_model.py
Last active August 11, 2022 07:43
register a model to sagemaker model group
import boto3
sm_client = boto3.client('sagemaker', region_name='us-east-1')
model_url = "s3://sagemaker-us-east-1-.../sagemaker-scikit-learn-.../output/model.tar.gz"
modelpackage_inference_specification = {
"InferenceSpecification": {
"Containers": [
@gleeb
gleeb / create_model_from_registry.py
Created August 8, 2022 10:00
Sagemaker create model from registry
import boto3
from datetime import datetime
sm_client = boto3.client('sagemaker', region_name='us-east-1')
model_name = 'titanic-survival-v1'
print("Model name : {}".format(model_name))
container_list = [{'ModelPackageName': 'arn:aws:sagemaker:us-east-1:...:model-package/titanic-survival/3'}]
@gleeb
gleeb / create_endpoint_config.py
Created August 8, 2022 11:52
sagemaker reate endpoint config
import boto3
sm_client = boto3.client('sagemaker', region_name='us-east-1')
endpoint_config_name = 'titanic-survival-endpoint-config'
print(endpoint_config_name)
create_endpoint_config_response = sm_client.create_endpoint_config(
EndpointConfigName = endpoint_config_name,
ProductionVariants=[{
'InstanceType':'ml.m4.xlarge',
'InitialVariantWeight':1,