Skip to content

Instantly share code, notes, and snippets.

View anubhavsinha's full-sized avatar

Anubhav Sinha anubhavsinha

View GitHub Profile
from fabric.api import *
env.hosts = ['host.name.com']
env.user = 'user'
env.key_filename = '/path/to/keyfile.pem'
def local_uname():
local('uname -a')
def remote_uname():
@anubhavsinha
anubhavsinha / fabfile.py
Created August 23, 2014 00:37
running different commands on different hosts.
from fabric.api import *
from fabric.context_managers import settings
hosts = ['10.10.6.234', '10.10.6.65']
env.user = 'ubuntu'
env.key_filename = '/home/as/work/credentials/pipeline.pem'
def local_uname():
local('uname -a')
def remote_uname():
@anubhavsinha
anubhavsinha / install_java.sh
Created September 14, 2014 10:50
installing latest Java version 8 update 20 on Ubuntu 14.04
add-apt-repository ppa:webupd8team/java
apt-get update
apt-get install oracle-java8-installer
apt-get install oracle-java8-set-default
@anubhavsinha
anubhavsinha / install_elasticsearch.sh
Last active August 29, 2015 14:06
install elastic search on Ubuntu 14.04 (assuming Java version 8, update 20 already installed)
# But first install Java version update 20
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.5.2.zip
apt-get install unzip
unzip elasticsearch-1.5.2 -d /usr/local/elasticsearch
cd /usr/local/elasticsearch/elasticsearch-1.5.2/
bin/plugin -install elasticsearch/elasticsearch-cloud-aws/2.4.1
bin/plugin -i elasticsearch/marvel/latest
echo "ulimit -n 32000" > /etc/rc.local # we need to increase the max file descriptors from 4096 to 32k
echo "export ES_HEAP_SIZE=30g" > /etc/rc.local # keep heap size half of the total available RAM. Should be under 32g to avoid jvm issues.
echo "cd /usr/local/elasticsearch/elasticsearch-1.5.2/ && bin/elasticsearch -d" >> /etc/rc.local
@anubhavsinha
anubhavsinha / purge_queue.py
Created January 17, 2015 18:46
purge a rabbitmq queue
from amqplib import client_0_8 as amqp
conn = amqp.Connection(host="mq.example.com:5672", userid="admin", password="p@ssw0rd!", virtual_host="/", insist=False)
conn = conn.channel()
queues = ['celery']
for q in queues:
if q:
#print 'deleting %s' % q
@anubhavsinha
anubhavsinha / teamviewer.sh
Created January 27, 2015 17:19
install teamviewer 10 on ubuntu 14.04 LTS
wget --no-check-certificate http://www.teamviewer.com/download/teamviewer_linux.deb
sudo dpkg --add-architecture i386 && sudo apt-get update && sudo dpkg -i teamviewer_linux.deb && sudo apt-get install -f -y
@anubhavsinha
anubhavsinha / ssh_remove.sh
Created January 27, 2015 18:38
remove a host from known_hosts
ssh-keygen -f "/home/as/.ssh/known_hosts" -R 10.10.6.193
@anubhavsinha
anubhavsinha / install_hub.sh
Last active August 29, 2015 14:19
installing hub, the git wrapper command line tool
sudo apt-get install ruby
sudo curl https://hub.github.com/standalone -Lo /usr/bin/hub
sudo chmod 755 /usr/bin/hub
alias git=hub
@anubhavsinha
anubhavsinha / opentar.sh
Created April 18, 2015 21:31
tar to a specific folder
tar xf archive.tar -C /target/directory --strip-components=1
#Note that if your tarball already contains a directory name you want to change, adding --strip-components=1 is needed.