Skip to content

Instantly share code, notes, and snippets.

View anubhavsinha's full-sized avatar

Anubhav Sinha anubhavsinha

View GitHub Profile
import paramiko
k = paramiko.RSAKey.from_private_key_file("/Users/whatever/Downloads/mykey.pem")
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
print "connecting"
c.connect( hostname = "www.acme.com", username = "ubuntu", pkey = k )
print "connected"
commands = [ "/home/ubuntu/firstscript.sh", "/home/ubuntu/secondscript.sh" ]
for command in commands:
print "Executing {}".format( command )
@anubhavsinha
anubhavsinha / mongodb-client-install.sh
Last active August 29, 2015 14:03
install just the mongodb client: mongo
# useful when you want to debug a docker container running the mongodb server
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update
sudo apt-get install mongodb-org-shell mongodb-org-tools
@anubhavsinha
anubhavsinha / gist:abee1a8d3e0807580204
Last active August 29, 2015 14:03
aws-cli-config.sh
export AWS_ACCESS_KEY_ID=your_access_key_id
export AWS_SECRET_ACCESS_KEY=your_secret_access_key
sudo apt-get install unzip;
wget -O /tmp/chromedriver.zip http://chromedriver.googlecode.com/files/chromedriver_linux64_19.0.1068.0.zip && sudo unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/;
@anubhavsinha
anubhavsinha / git_clone.sh
Last active August 29, 2015 14:04
Adding an alias to save us from typing long git clone commands.
#########################################################
# Save this file to your /usr/local/bin (Ubuntu 14.04LTS)
# then run chmod 755 git_clone.sh
# add the following line to your .bash_aliases file.
# alias clone='/usr/local/bin/git_clone.sh'
# Now you can use it like
# as@xps:~/works$ clone awsma-server
# instead of typing the long version
# git clone git@github.com:anubhavsinha/awsma-server.git
# You should also add your ssh key to github.
@anubhavsinha
anubhavsinha / wrapword.css
Created July 31, 2014 20:50
wraps around the words
.wrapword{
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: pre-wrap; /* css-3 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
word-break: break-all;
white-space: normal;
}
@anubhavsinha
anubhavsinha / detox.sh
Created August 8, 2014 19:14
remove bad file names - names with white space in them.
find . -depth -name '* *' \
| while IFS= read -r f ; do mv -i "$f" "$(dirname "$f")/$(basename "$f"|tr ' ' _)" ; done
@anubhavsinha
anubhavsinha / git_deploy_docker.py
Last active August 29, 2015 14:05
A flask script to listen for POST hooks for the production branch.
###################################################################
# TODO:
# add logging and ses email alerts for deployment failed and passed.
# Also pipe in the log file to logstash etc.
# Also write test cases
# Make all of the deployment task async and return to the POST request immediately.
# Already uses auto-reload - flask debug=True provides auto-reload out of t
# You will need to
# cd ~
@anubhavsinha
anubhavsinha / docker_remove_all.sh
Created August 14, 2014 19:21
alias for stop and rm all docker containers
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
# docker build -t="rails" .
FROM ubuntu:12.04
RUN apt-get update
## MYSQL
RUN apt-get install -y -q mysql-client libmysqlclient-dev
## RUBY