Skip to content

Instantly share code, notes, and snippets.

View sanketsudake's full-sized avatar

Sanket Sudake sanketsudake

View GitHub Profile
ISSUE SUMMARY
DETAILED DESCRIPTION OF IMPACT
ROOT CAUSE
REMEDIATION AND PREVENTION
@sanketsudake
sanketsudake / aws_instances.sh
Last active July 5, 2018 10:02
List ALL AWS Instances
for region in `aws ec2 describe-regions --output text | cut -f3`
do
echo -e "Instances in region:'$region'..."
aws ec2 describe-instances --region $region --query 'Reservations[].Instances[].[State.Name,KeyName,InstanceType,Tags[].Value,PublicIpAddress]'
done
@sanketsudake
sanketsudake / tensorflow_device_info.py
Created May 29, 2018 05:29
Get devices available for Tensorflow Computations
from tensorflow.python.client import device_lib
def get_available_devices():
"""
>>> get_available_devices()
['/device:CPU:0']
"""
devices_info = device_lib.list_local_devices()
return [dev.name for dev in devices_info]
# Training job contains 1 Tensorflow master,1 Tensorflow worker and 2 parameter servers.
# In replica specifications, we specify replica type and replica specific details like container image etc.
apiVersion: "kubeflow.org/v1alpha1"
kind: "TFJob"
metadata:
name: "example-job"
spec:
replicaSpecs:
- replicas: 1
tfReplicaType: MASTER
@sanketsudake
sanketsudake / Kubeflow_install.sh
Last active May 21, 2018 13:33
Get Kubeflow Running for Myself
NAMESPACE=kubeflow
kubectl create namespace ${NAMESPACE}
VERSION=v0.1.2
APP_NAME=my-kubeflow
ks init ${APP_NAME}
cd ${APP_NAME}
ks env set default --namespace ${NAMESPACE}
ks registry add kubeflow github.com/kubeflow/kubeflow/tree/${VERSION}/kubeflow
ks pkg install kubeflow/core@${VERSION}
ks pkg install kubeflow/tf-serving@${VERSION}
@sanketsudake
sanketsudake / Makefile
Created September 18, 2017 07:25 — forked from rcmachado/Makefile
Add a help target to a Makefile that will allow all targets to be self documenting
.SILENT:
.PHONY: help
# Based on https://gist.github.com/prwhite/8168133#comment-1313022
## This help screen
help:
printf "Available targets\n\n"
awk '/^[a-zA-Z\-\_0-9]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
@sanketsudake
sanketsudake / GCE Python Sample
Created September 17, 2017 16:18
[WIP] List Google Compute Engine Resources
# pip install google-api-python-client>=1.4.2
from googleapiclient.discovery import build
from oauth2client.client import GoogleCredentials
service_key='service_key.json'
project='myproject'
credentials = GoogleCredentials.from_stream(service_key)
service = build('compute', 'beta', credentials=credentials)
service.machineTypes().list(project=project, zone='us-central1-c').execute()
service.networks().list(project=project, zone='us-central1-c').execute()
ssh-keygen -E md5 -lf ~/.ssh/id_rsa.pub | awk '{print $2}' | cut -c 5-
@sanketsudake
sanketsudake / recover_source_code.md
Created March 12, 2017 06:29 — forked from simonw/recover_source_code.md
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
check()
{
if [ `echo $?` -ne 0 ] ; then
echo "Failure Observerd"
exit 1
fi
}
doit()
{