Skip to content

Instantly share code, notes, and snippets.

View anubhavsinha's full-sized avatar

Anubhav Sinha anubhavsinha

View GitHub Profile
@anubhavsinha
anubhavsinha / port-forwarding.sh
Created August 5, 2015 18:57
port forwarding using iptables
sudo iptables -t nat -A PREROUTING -p tcp --dport 3000 -j DNAT --to-destination 172.17.20.158:3000
@anubhavsinha
anubhavsinha / mac.py
Created June 4, 2015 18:44
some python code
import platform
if platform.system()=='Darwin':
print 'Mac'
@anubhavsinha
anubhavsinha / virtualbox.sh
Last active August 29, 2015 14:19
install virtual box 4.3 on Ubuntu 14.04 LTS
sudo sh -c "echo 'deb http://download.virtualbox.org/virtualbox/debian '$(lsb_release -cs)' contrib non-free' > /etc/apt/sources.list.d/virtualbox.list" && wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add - && sudo apt-get update && sudo apt-get install virtualbox-4.3 dkms
# There are a few extra features, such as USB support, which are closed-source and distributed in separate extension packs.
wget http://download.virtualbox.org/virtualbox/4.3.10/Oracle_VM_VirtualBox_Extension_Pack-4.3.10-93012.vbox-extpack
sudo VBoxManage list extpacks
sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.3.10-93012.vbox-extpack
sudo VBoxManage list extpacks
@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.
@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 / main.yml
Created March 12, 2015 22:33
newrelic server monitoring ansible role for Ubuntu
# Install newrelic server monitoring
# Add newrelic repository
- apt_repository: repo='deb http://apt.newrelic.com/debian/ newrelic non-free' state=present
# Trust the New Relic GPG key.
- apt_key: url=https://download.newrelic.com/548C16BF.gpg state=present
# Update and install apt packages
- name: Run apt-get update
apt: update_cache=yes
@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 / 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 / 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 / rabbitmq.sh
Created January 15, 2015 21:02
rabbimq on ubuntu 14.04LTS
sudo apt-get update
# install erlang
sudo apt-get install erlang -y
sudo apt-get install erlang-nox -y
# get deb package
echo deb http://www.rabbitmq.com/debian/ testing main | sudo tee /etc/apt/sources.list
# add key