Skip to content

Instantly share code, notes, and snippets.

@manku-timma
manku-timma / Jenkins.py
Created July 28, 2018 13:32
Download the latest unit test run status for Apache Spark 2.2.1 from AMPLab Jenkins instance
import sys
import json
import requests
response = requests.get('https://amplab.cs.berkeley.edu/jenkins/job/spark-branch-2.2-test-maven-hadoop-2.6/lastSuccessfulBuild/api/json')
parsed = json.load(sys.stdin)
print json.dumps(parsed['actions'][7], indent=4, sort_keys=True)
@manku-timma
manku-timma / Config.scala
Created January 19, 2015 13:45
Scala program to print all properties of a hadoop config
import org.apache.hadoop.conf.Configured
import org.apache.hadoop.util.Tool
import org.apache.hadoop.util.ToolRunner
import scala.collection.JavaConversions._
object Config extends Configured with Tool {
def run(args: Array[String]) : Int = {
getConf.map(x => (x.getKey, x.getValue)).toList.sorted.foreach(println)
return 0
}
diff --git a/lib/taskwarrior-web/app.rb b/lib/taskwarrior-web/app.rb
index 48da31a..ea3e7a1 100644
--- a/lib/taskwarrior-web/app.rb
+++ b/lib/taskwarrior-web/app.rb
@@ -154,6 +154,8 @@ class TaskwarriorWeb::App < Sinatra::Base
get('/ajax/projects/?') { TaskwarriorWeb::Command.new(:projects).run.split("\n").to_json }
get('/ajax/count/?') { task_count }
post('/ajax/task-complete/:id/?') { TaskwarriorWeb::Command.new(:complete, params[:id]).run }
+ post('/ajax/task-start/:id/?') { TaskwarriorWeb::Command.new(:start, params[:id]).run }
+ post('/ajax/task-stop/:id/?') { TaskwarriorWeb::Command.new(:stop, params[:id]).run }
@manku-timma
manku-timma / connected-components.cpp
Created August 16, 2014 01:08
Program for finding connected components using quick-find
#ifndef __GRAPH_H_INCLUDED__
#define __GRAPH_H_INCLUDED__
#include <vector>
#include <iostream>
#include <cassert>
class ConnectedComponents {
private:
std::vector<int> set;
  • It supports SQL, Scala, Java, Python, etc
  • It supports hive tables, json tables, native scala data structures etc as RDDs
  • It supports batch, streaming, interactive, iterative etc modes of computation
  • It supports AWS, Mesos, YARN, openstack etc as underlying computation engines
  • It supports tachyon, hdfs, s3, hive as storage engines; also DBs and noSQL DBs

Useful scala links

@manku-timma
manku-timma / main.c
Created July 22, 2014 08:10
Graph main file - Toy programs to play with graph algorithms
#include <stdio.h>
#include "graph.h"
int edges[] = {
0, 1,
0, 2,
1, 3,
2, 4,
2, 5,
4, 5,
@manku-timma
manku-timma / graph.c
Created July 22, 2014 08:09
Graph implementation file - Toy programs for implementing graph algorithms
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include "graph.h"
void graph_init(struct graph* g) {
for (int i = 0; i < MAX_VERTICES; i++) {
g->vertices[i] = i;
}
for (int i = 0; i < MAX_VERTICES; i++) {
@manku-timma
manku-timma / graph.h
Created July 22, 2014 08:08
Graph api file - Toy programs for implementing graph algorithms
#ifndef __GRAPH_H_INCLUDED__
#define __GRAPH_H_INCLUDED__
#define MAX_VERTICES 10
struct graph {
int vertices[MAX_VERTICES];
int edges[MAX_VERTICES][MAX_VERTICES];
int visited[MAX_VERTICES];
};
@manku-timma
manku-timma / producer-consumer.c
Created July 22, 2014 00:37
Example program for producer-consumer implementation using pthread apis
#include <stdio.h>
#include <pthread.h>
#define MAX 1024
int shared_buffer[MAX];
int producer_index;
int consumer_index;
int num_items;
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;