Skip to content

Instantly share code, notes, and snippets.

View rsrini7's full-sized avatar
😃
Happy

Srinivasan Ragothaman rsrini7

😃
Happy
View GitHub Profile
@rsrini7
rsrini7 / CallBack.java
Created January 31, 2014 13:48
Callback method through reflection in java
package com.sriniproj.callback;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class CallBack {
public static Object invoke(Object scope, String methodName,
Object... parameters) {
Object object = null;
@rsrini7
rsrini7 / NullSimulator
Created February 14, 2014 04:13
ArrayList, Collections.synchronizedList and CopyOnWriteArrayList with null simulator
package com.srini.util;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
public class NullSimulator implements Runnable
{
public static Map<String,List<String>> map=new HashMap<String, List<String>>();
@rsrini7
rsrini7 / HigherOrderFunction
Created April 8, 2014 08:52
Javascript - Higher Order Function
<!DOCTYPE html>
<html>
<body>
<script language="javascript" type="text/javascript">
<!--
// Define two simple functions
var add_2 = function(x) {
return x + 2;
};
var double = function(x) {
import org.apache.spark.storage.StorageLevel
import org.apache.spark.streaming.{ Seconds, StreamingContext }
import org.apache.spark.streaming.StreamingContext._
import org.apache.spark.streaming.twitter._
import org.sedis._
import redis.clients.jedis._
object TwitterWordCount {
def main(args: Array[String]) {
:: Name: Startup.Cmd.cmd
:: Purpose: Initializes a Windows command prompt shell
:: Author: stevejansen_github@mac.com
:: Revision: April 2012
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS
:: self-install this script, but, don't force an overwrite if an auto run script is already configured
IF /I "%~1"=="/install" (
# Remove old data
curl -XDELETE "http://localhost:9200/testindex"
# Create index with mapping
curl -XPOST "http://localhost:9200/testindex/" -d '
{
"mappings" : {
"testtype" : {
"properties" : {
"available_for_client" : {
###################################################
###################################################
# Crash course
###################################################
###################################################
En
###################################################
# Quickstart
###################################################
#!/bin/sh
# one way (older scala version will be installed)
# sudo apt-get install scala
#2nd way
sudo apt-get remove scala-library scala
wget http://www.scala-lang.org/files/archive/scala-2.11.4.deb
sudo dpkg -i scala-2.11.4.deb
sudo apt-get update
# stacktrace java as one message
multiline {
#type => "all" # no type means for all inputs
pattern => "(^.+Exception: .+)|(^\s+at .+)|(^\s+... \d+ more)|(^\s*Caused by:.+)"
what => "previous"
}
# stacktrace java as one message
multiline {
#type => "all" # no type means for all inputs
pattern => "(^.+Exception: .+)|(^\s+at .+)|(^\s+... \d+ more)|(^\s*Caused by:.+)"
what => "previous"
}