Skip to content

Instantly share code, notes, and snippets.

Avatar

Shrivatsan Rajagopalan nrshrivatsan

View GitHub Profile
@nrshrivatsan
nrshrivatsan / Groovy-delete-all-jenkins-jobs
Created Apr 22, 2017
Jenkins-delete-all-jobs : Groovyscript
View Groovy-delete-all-jenkins-jobs
import hudson.model.*
disableChildren(Hudson.instance.items)
def disableChildren(items) {
for (item in items) {
if (item.class.canonicalName == 'com.cloudbees.hudson.plugins.folder.Folder') {
disableChildren(((com.cloudbees.hudson.plugins.folder.Folder) item).getItems())
} else if (item.class.canonicalName != 'org.jenkinsci.plugins.workflow.job.WorkflowJob') {
@nrshrivatsan
nrshrivatsan / mesosphere-marathon-jenkins-app.json
Created Jun 24, 2016
Marathon - Jenkins task. NOTE - Assumes jenkins war is downloaded into /usr/share/jenkins.war with read privledges
View mesosphere-marathon-jenkins-app.json
[
{
"id": "/jl2",
"cmd": "java -jar /usr/share/jenkins.war --httpPort=10002 ",
"cpus": 0.1,
"mem": 80,
"disk": 0,
"instances": 1,
"portDefinitions": [
{
@nrshrivatsan
nrshrivatsan / linux-diagnostics-tools.sh
Created Dec 8, 2015
Install list of diagnostic tools for linux
View linux-diagnostics-tools.sh
sudo apt-get update && sudo apt-get install -y bind9 iptraf linux-tools-common systemtag systemtap-sdt-dev sysdig lttng-tools nicstat dstat snmp lldpad
@nrshrivatsan
nrshrivatsan / dataframes-apache-spark.scala
Created Sep 1, 2015
A simple hack to load CSV contents into apache spark dataframes
View dataframes-apache-spark.scala
//Start spark using https://github.com/databricks/spark-csv#spark-compiled-with-scala-211
//$SPARK_HOME/bin/spark-shell --packages com.databricks:spark-csv_2.11:1.2.0
import org.apache.spark.sql.SQLContext
val sqlContext = new SQLContext(sc)
//Download Google Stock info CSV from Quandl
val df = sqlContext.read.format("com.databricks.spark.csv").option("header", "true").load("YAHOO-GOOG.csv")
df.columns
View art-meets-math.js
<!DOCTYPE HTML>
<html>
<head>
<style>
body {
margin: 0px;
padding: 0px;
}
</style>
</head>
@nrshrivatsan
nrshrivatsan / gene_compression.py
Created Aug 20, 2015
A simple binary compression algorithm for ATGC sequence using python
View gene_compression.py
"""
Name: Shrivats
Bit Compression of ATGC
"""
bit_seq = 0
input_seq = 'ATGC'
input_seq+='GTAC'
# input sequence
@nrshrivatsan
nrshrivatsan / bwtransform.py
Created Jul 8, 2015
Burrow Wheeler Transform in Python - a simple implementations
View bwtransform.py
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 / etcd_load.js
Created Jun 14, 2015
ETCD load script in nodejs
View etcd_load.js
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 / ectd_load.go
Last active Aug 29, 2015
Minor Load script on ETCD
View ectd_load.go
package main
import (
"fmt"
"net/http"
"io/ioutil"
"bytes"
"strconv"
"math/rand"
)
@nrshrivatsan
nrshrivatsan / httpGetJSON.jl
Last active Nov 28, 2016
Julia lang - Read JSON from URL
View httpGetJSON.jl
#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);