Skip to content

Instantly share code, notes, and snippets.

Avatar

Alex Staravoitau navoshta

View GitHub Profile
@navoshta
navoshta / fenton.sh
Last active Feb 24, 2017
Routines for SSH-ing to remote machine, mount its file system and attach to a persistent tmux session. Check out my post about building and configuring my remote machine: http://navoshta.com/meet-fenton/
View fenton.sh
#!/bin/bash
# Connects to remote server, mounts its file system or attaches to a tmux session.
USER="tom"
SERVER="$USER@10.23.45.67:8989"
LOCAL_KEY_PATH="/Users/tom/ssh_keys/key"
LOCAL_MOUNT_PATH="/Users/tom/mount/"
if [ $# -eq 0 ]; then
@navoshta
navoshta / aws_stop.sh
Last active Nov 23, 2016
Stops your AWS instance. Check out my post about usage of this script: http://navoshta.com/aws-tensorflow/
View aws_stop.sh
#!/bin/bash
# Checks current AWS instance state and stops it if it's running.
AWS_INSTANCE_ID="<Your instance ID here>"
AWS_STATE=$(aws ec2 describe-instances --instance-ids $AWS_INSTANCE_ID --query "Reservations[*].Instances[*].State.Name" --output text)
if [ "$AWS_STATE" == "running" ]; then
aws ec2 stop-instances --instance-ids $AWS_INSTANCE_ID >/dev/null
echo -n "The AWS instance is now stopping. It usually takes a while, so feel free to CTRL+C if you don't want to wait till the instance has fully stopped."
@navoshta
navoshta / aws_start.sh
Last active May 2, 2017
Starts your AWS instance. Check out my post about usage of this script: http://navoshta.com/aws-tensorflow/
View aws_start.sh
#!/bin/bash
# Starts your AWS instance, connects via SSH and launches Chrome with the remote Jupyter Notebook page open.
# Usage is as follows:
# 1. Run this script, so that Chrome has launched and SSH connection is established.
# 2. Execute 'jupyter notebook' on the AWS instance.
# 3. Reload the page in Chrome and log in to Jupyter Notebook.
#
# Note: we use Chrome, as there's a known issue with Safari that won't let Jupyter Notebook connect to a remote kernel.
#