Skip to content

Instantly share code, notes, and snippets.

View nrshrivatsan's full-sized avatar

Shrivatsan Rajagopalan nrshrivatsan

View GitHub Profile
@nrshrivatsan
nrshrivatsan / mesos-one-command.sh
Last active August 29, 2015 14:02
A single Shell file to setup mesos
sudo apt-get install -y git build-essential openjdk-6-jdk python-dev python-boto libcurl4-nss-dev libsasl2-dev autoconf libtool maven
git clone http://git-wip-us.apache.org/repos/asf/mesos.git
cd mesos
./bootstrap
mkdir build
cd build
../configure
make -j 4
make check
@nrshrivatsan
nrshrivatsan / wikilinks.go
Created June 27, 2014 00:50
Wiki-links - Gets JSON API endpoints of hyperlinks present in a given wiki page [go get github.com/opesun/goquery]
@nrshrivatsan
nrshrivatsan / installGo
Created July 7, 2014 01:06
Golang - latest version on ubuntu
wget https://godeb.s3.amazonaws.com/godeb-amd64.tar.gz
tar -zxf godeb-amd64.tar.gz
./godeb install
@nrshrivatsan
nrshrivatsan / gevent-network-io-script
Created July 11, 2014 14:11
A sample implementation of Python 2.7 Gevent parallel hit of 200+ URLs
import gevent, urllib2
urls = ["http://ppcdn.500px.org/53472962/016dc8008e0e1b0a71437a18ec4ef502c0e69cf6/5.jpg", "http://ppcdn.500px.org/53498178/0d13aa906538a8021568b948edfe3a3b3343dcf2/5.jpg", "http://ppcdn.500px.org/53495988/69d5a868beb9a4610e06ad1d64efa10204f8f45c/5.jpg", "http://ppcdn.500px.org/53488670/be88ee3404909ffb5e0f058133c8cb3cb3c61582/5.jpg", "http://ppcdn.500px.org/53472200/d23ece8bf9ab2f405b396edaf38a6ef77aab0c1e/5.jpg", "http://ppcdn.500px.org/53450310/977ea22beefa8c7148b3155bd829209a3ccf3330/5.jpg", "http://ppcdn.500px.org/53503408/5ed549003f8e919a3bf4b55f1e47dfa76ff77218/5.jpg", "http://ppcdn.500px.org/53496530/4a724f69bb4c1cb5e890594967572584f0c405cc/5.jpg", "http://ppcdn.500px.org/53493274/d55f2a1c0e639888d2ac7f20c04d360a18a75511/5.jpg", "http://ppcdn.500px.org/53478682/60a97a27221b471a00d2ea4c8a080cdf05350865/5.jpg", "http://ppcdn.500px.org/53472206/c99f0f1329f9ba908080cfb20def5fae433163da/5.jpg", "http://ppcdn.500px.org/53470904/5b99c63c3f1d1d19e01e73f49e88d72dc5776dca/5.jpg", "http:/
@nrshrivatsan
nrshrivatsan / rabbitmq-enabled-management-console.sh
Created December 17, 2014 23:05
Enable RabbitMQ Management Console
rabbitmq-plugins enable rabbitmq_management
@nrshrivatsan
nrshrivatsan / foodfacts.js
Last active August 29, 2015 14:20
Good and Bad parts of our dailyfood - powered by foodfacts.com. Input - Some Food you need every day in single-quotes
var input = process.argv.slice(2);
var request = require('request'), cheerio = require('cheerio');
req = request.defaults({
jar : true,
rejectUnauthorized : false,
followAllRedirects: true
});
function getContentAndScrape (url, selector) {
//Get Ingredients
req.get({
@nrshrivatsan
nrshrivatsan / ectd_load.go
Last active August 29, 2015 14:23
Minor Load script on ETCD
package main
import (
"fmt"
"net/http"
"io/ioutil"
"bytes"
"strconv"
"math/rand"
)
@nrshrivatsan
nrshrivatsan / etcd_load.js
Created June 14, 2015 15:51
ETCD load script in nodejs
var request = require('request');
for(var i = 0; i <= 5000; i++) {
setTimeout(
function(){
request.post(
'http://127.0.0.1:2379/v2/keys/k'+i,
{ form: { value: 'load' } },
function (error, response, body) {
if (!error
&& response.statusCode == 201
@nrshrivatsan
nrshrivatsan / bwtransform.py
Created July 8, 2015 03:12
Burrow Wheeler Transform in Python - a simple implementations
def rot(x):
k = x[0:len(x)-1]
k = x[len(x)-1]+(k)
return k
x = "UnitedStatesOfAmerica"
k = x
rotations = []
rotations.append(k)
@nrshrivatsan
nrshrivatsan / gene_compression.py
Created August 20, 2015 23:00
A simple binary compression algorithm for ATGC sequence using python
"""
Name: Shrivats
Bit Compression of ATGC
"""
bit_seq = 0
input_seq = 'ATGC'
input_seq+='GTAC'
# input sequence