Skip to content

Instantly share code, notes, and snippets.

@albertstartup
albertstartup / user-data-mnt-tmp.sh
Created June 20, 2016 19:24
user-data script to set proper /mnt/tmp permission after /mnt is delete from instance termination
#!/bin/bash
if [ -d /mnt ] && [ ! -e /mnt/tmp ] ; then
sudo mkdir /mnt/tmp
sudo chmod 777 /mnt/tmp
fi
@albertstartup
albertstartup / setup.sh
Last active March 7, 2018 02:22
script to automatically setup nvidia driver 367.27, cuda 8, cudnn 5, on aws gpu
#!/bin/bash
set -o nounset
set -o errexit
# Required!
# downloads/ directory with:
# cuda_8.0.27_linux.run with md5 checksum: bea6165ccd0a6690cac04ed9544bbe57
# cudnn-8.0-linux-x64-v5.0-ga.tgz with md5 checksum: be1896b0db052a7ca06a062262c4b842
NVIDIA_FILENAME=NVIDIA-Linux-x86_64-367.27.run
@albertstartup
albertstartup / spot-price-for-all.py
Created July 1, 2016 04:14
get the latest spot price for all regions
# must set aws credentials
import boto3
from datetime import datetime
from dateutil.tz import tzutc
from operator import itemgetter
from functools import partial
from pipe import Pipe
def get_region_history(region):
remove_windows = partial(filter, lambda item: item['ProductDescription'] != 'Windows')
@albertstartup
albertstartup / setup-tensorflow.sh
Last active October 10, 2016 01:44
setup tensorflow on aws
#!/bin/bash
set -o nounset
set -o errexit
git clone https://github.com/tensorflow/tensorflow
sudo apt-get install -y openjdk-8-jdk libcurl4-openssl-dev python3-numpy swig python3-dev python3-pip python3-setuptools zlib1g-dev
echo "deb http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
curl https://storage.googleapis.com/bazel-apt/doc/apt-key.pub.gpg | sudo apt-key add -
@albertstartup
albertstartup / setup-theano.sh
Last active July 5, 2016 05:39
dev setup theano in aws gpu
sudo apt-get install -y python3-numpy python3-scipy python3-dev libopenblas-dev python3-pip
git clone https://github.com/Theano/Theano.git
cd Theano
sudo python3 setup.py develop
cd ~
@albertstartup
albertstartup / easy-setup-theano.sh
Last active July 5, 2016 03:12
easy setup theano aws
sudo apt-get install -y python3-numpy python3-scipy python3-dev libopenblas-dev python3-pip
sudo pip3 install Theano
echo -e "[global]\ndevice = gpu\nfloatX = float32" > ~/.theanorc
@albertstartup
albertstartup / hide-backup.el
Last active August 5, 2016 12:09
Hide backup files (~filename) in temporary directory.
;;; hide-backup.el --- Hide backup files (~filename) in temporary directory.
(setq backup-directory-alist
`((".*" . ,temporary-file-directory)))
(provide 'hide-backup)
@albertstartup
albertstartup / toggle-mode-line.el
Last active August 5, 2016 12:10
Toggle mode line.
;;; toggle-mode-line.el --- Toggle mode line.
(defun toggle-mode-line ()
(interactive)
(if mode-line-format
(progn (setq-local hidden-mode-line-format mode-line-format)
(setq mode-line-format nil))
(setq mode-line-format hidden-mode-line-format))
(force-mode-line-update))
@albertstartup
albertstartup / enable-narrowing.el
Last active August 5, 2016 12:03
Enable narrowing.
;;; enable-narrowing.el --- Enable narrowing.
(put 'narrow-to-defun 'disabled nil)
(put 'narrow-to-page 'disbled nil)
(put 'narrow-to-region 'disabled nil)
(provide 'enable-narrowing)
@albertstartup
albertstartup / blank-stage.el
Last active August 5, 2016 12:08
Blank stage.
;;; blank-stage.el --- Blank stage.
(menu-bar-mode -1)
(setq initial-scratch-message "")
(setq inhibit-startup-message t)
(provide 'blank-stage)