Skip to content

Instantly share code, notes, and snippets.

View anubhavsinha's full-sized avatar

Anubhav Sinha anubhavsinha

View GitHub Profile
@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 / mac.py
Created June 4, 2015 18:44
some python code
import platform
if platform.system()=='Darwin':
print 'Mac'
@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 / dynamodb.js
Created August 12, 2015 18:08
Amazon DynamoDB NodeJS example script
var AWS = require('aws-sdk'); // credentials can be loaded through IAM role
var dynamodb = new AWS.DynamoDB();
var item = {
"Color":{"S":"white"},
"Name":{"S":"fancy vase"},
"Weight":{"N":"2"},
"LastName":{"S":"Kumar"}
}
// To put an item to DynamoDB
@anubhavsinha
anubhavsinha / remove_dupes.py
Created September 1, 2012 16:27
list vs set: Python
#function to remove duplicates from a Python list
#using append/add is O(1) for both list and set
#but using in/not in/remove in list is O(n) vs O(1) in case of set
def remove_dupes(some_list):
seen = set()
items = []
for each in some_list:
if each not in seen:
seen.add(each)
@anubhavsinha
anubhavsinha / cv-resume.md
Created September 16, 2012 22:40
A write-up of things I have done. This may be considered as my cv/resume for hiring/consultancy purpose.

#Anubhav Sinha ####Bangalore, India

@anubhavsinha
anubhavsinha / amazon-rhel-7.sh
Created October 15, 2015 10:38
Enable repositories om Amazon RHEL 7
sudo yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional
@anubhavsinha
anubhavsinha / ansible.sh
Created October 15, 2015 12:16
Running the ansible command on servers with common user and .pem file
ansible all -m ping -i inventory_file --user=ec2-user --private-key=../k8s.pem
@anubhavsinha
anubhavsinha / fixing_ssh.sh
Created October 17, 2015 02:43
Fixing SSH session freeze issue due to Routers/NATs closing inactive connections
# sudo vi /etc/ssh/ssh_config
# keep ssh sessions fresh
Host *
ServerAliveInterval 60
@anubhavsinha
anubhavsinha / mesos.sh
Last active October 18, 2015 02:59
Mesos on AWS RHEL 7
# Add the mesosphere repository
sudo rpm -Uvh http://repos.mesosphere.com/el/7/noarch/RPMS/mesosphere-el-repo-7-1.noarch.rpm
sudo yum update -y
# For mesos-master-zookeeper-metaframework nodes - start 3 of these for a HA setup
sudo yum install mesos marathon chronos mesosphere-zookeeper
# For mesos-slave
sudo yum install mesos