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 / kill_all_tomcat_procs
Created July 3, 2014 19:11
kill all tomcat processes in Xinx
ps -ef | grep tomcat | awk '{print $2}' | xargs kill -9
@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 / apache_not_nginx
Last active December 5, 2016 05:24
Ubuntu Kill nginx + Start Apache 2
# ubuntu 14.01 comes with nginx I guess.For simple testing purposes I use apache2.
########################################################
# Assumption
# - nginx & apache2 have already been installed on ubuntu 14.04
# Goal
@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 / httpGetJSON.jl
Last active November 28, 2016 21:26
Julia lang - Read JSON from URL
#Importing Requests package
Pkg.add("Requests")
using Requests.get;
import JSON;
url = "http://query.yahooapis.com/v1/public/yql?q=select%20DaysRange%20from%20yahoo.finance.quotes%20where%20symbol%20in%20%28%22EBAY%22,%22GOOG%22%29%20&env=http://datatables.org/alltables.env&format=json";
#Reads the data from HTTP URL
es = get(url);
@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"
)