Skip to content

Instantly share code, notes, and snippets.

View michaelwsherman's full-sized avatar

Michael W. Sherman michaelwsherman

View GitHub Profile
@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 / deactivate.sh
Created April 5, 2019 22:29
Deactivate a virtual environment.
deactivate
export VENV_PATH="venv"
source $VENV_PATH/bin/activate
@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 VENV_PATH="venv"
rm -r $VENV_PATH
@michaelwsherman
michaelwsherman / create_ipython_kernel.sh
Last active April 5, 2019 23:52
Creating an iPython kernel
export KERNEL_NAME="my_kernel"
export DISPLAY_NAME="Project Foo"
pip install ipykernel
python -m ipykernel install --name $KERNEL_NAME --display-name "$DISPLAY_NAME" --user
sudo jupyter labextension install @krassowski/jupyterlab_go_to_definition
@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 \
@michaelwsherman
michaelwsherman / gcloud_start_instance.sh
Last active April 8, 2019 21:33
Start a stopped VM.
export INSTANCE_NAME="my-instance"
export ZONE="us-west1-b"
gcloud compute instances start $INSTANCE_NAME \
--zone=$ZONE