Skip to content

Instantly share code, notes, and snippets.

View michaelwsherman's full-sized avatar

Michael W. Sherman michaelwsherman

View GitHub Profile
@michaelwsherman
michaelwsherman / create_venv.sh
Last active April 5, 2019 22:32
Basic virtual environment creation with virtualenv.
export VENV_PATH="venv"
virtualenv $VENV_PATH
@michaelwsherman
michaelwsherman / create_python2_venv.sh
Last active April 5, 2019 22:33
Creates a python2 virtual environment in the venv directory.
export VENV_PATH="venv"
virtualenv -p python2 $VENV_PATH
export INSTANCE_NAME="my-instance"
export ZONE="us-west1-b"
gcloud compute instances stop $INSTANCE_NAME \
--zone=$ZONE
@michaelwsherman
michaelwsherman / gcloud_remove_ssh_rule.sh
Last active April 8, 2019 21:34
Remove the SSH tag from a VM.
export INSTANCE_NAME="my-instance"
export ZONE="us-west1-b"
gcloud compute instances remove-tags $INSTANCE_NAME \
--zone=$ZONE \
--tags=ssh
@michaelwsherman
michaelwsherman / gcloud_apply_ssh_rule.sh
Last active April 8, 2019 21:35
Add an SSH tag to a VM.
export INSTANCE_NAME="my-instance"
export ZONE="us-west1-b"
gcloud compute instances add-tags $INSTANCE_NAME \
--zone=$ZONE \
--tags=ssh
@michaelwsherman
michaelwsherman / gcloud_create_ssh_rule.sh
Last active April 5, 2019 00:07
Create a firewall rule to allow SSH.
gcloud compute firewall-rules create allow-ssh \
--allow=tcp:22 \
--priority=0 \
--description='Open port 22 for SSH.' \
--target-tags=ssh
@michaelwsherman
michaelwsherman / gcloud_ssh_notebook.sh
Last active April 8, 2019 21:35
SSH to a Google Cloud Notebook
export INSTANCE_NAME="my-instance"
export ZONE="us-west1-b"
gcloud compute ssh $INSTANCE_NAME \
--zone=$ZONE
@michaelwsherman
michaelwsherman / gcloud_create_notebook.sh
Last active April 8, 2019 21:32
Create a Google Cloud Notebook for a Python IDE
export IMAGE_FAMILY="tf-latest-gpu"
export ZONE="us-west1-b"
export INSTANCE_NAME="my-instance"
export INSTANCE_TYPE="n1-standard-4"
gcloud compute instances create $INSTANCE_NAME \
--zone=$ZONE \
--image-family=$IMAGE_FAMILY \
--machine-type=$INSTANCE_TYPE \
--image-project=deeplearning-platform-release \
--maintenance-policy=TERMINATE \