Skip to content

Instantly share code, notes, and snippets.

View arun-rama's full-sized avatar

arun-rama (Arun Ramakrishnan) arun-rama

View GitHub Profile
@arun-rama
arun-rama / nube-scala-type1.scala
Created June 16, 2011 21:39
nube scala type inference
object Zip1 {
case class Str(value:String)
def main(args : Array[String]) : Unit = {
def getStuff() : Map[Int, Str] = {
val l1 = List(1,2,3)
val l2 = List( Str("one"), Str("two"), Str("three") )
@arun-rama
arun-rama / arun_ebs1
Created July 1, 2011 20:55
reconciling ebs volume size and df command output
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 7.9G 726M 6.8G 10% /
none 3.4G 112K 3.4G 1% /dev
none 3.6G 0 3.6G 0% /dev/shm
none 3.6G 48K 3.6G 1% /var/run
none 3.6G 0 3.6G 0% /var/lock
none 3.6G 0 3.6G 0% /lib/init/rw
/dev/sdb 414G 199M 393G 1% /mnt
@arun-rama
arun-rama / gist:1726258
Created February 2, 2012 22:42
scala actors 2.9 error ?
object Server extends Actor {
//event based server actor that schedules client requests
def act = eventloop {
case id: Int =>
//spawn a new thread based actor for processing client request with id:Int
println("Actor " + id);
actor {
receive{
@arun-rama
arun-rama / Akka_Supervising_With_Routers.scala
Created February 17, 2012 00:09
Akka Supervising with Routers 2.0-RC1
import akka.actor.{ Actor, OneForOneStrategy, ActorLogging, Props, ActorSystem }
import akka.routing.RoundRobinRouter
class TAct extends Actor with ActorLogging {
var cnt = 0
def receive = {
case s:String =>
cnt+=1
log.info("requested count {} req {}", cnt, s );
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for ch.qos.logback:logback-demo:war:1.0
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 116, column 15
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
@arun-rama
arun-rama / gist:2046251
Created March 15, 2012 19:23
Higgs dependencies
/Users/arun/workspace/DARKMATTER/Higgs>mvn dependency:tree
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Higgs 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ Higgs ---
[INFO] com.incentica:Higgs:jar:0.0.1-SNAPSHOT
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.5.11:compile
@arun-rama
arun-rama / gist:2705544
Created May 15, 2012 22:15
semantics behind _ in Scala method calls
//This compiles fine
object AppBuilder extends App {
def app( blockw: Int => String ) : List[String] = List( blockw(6) )
def app( block: => String ) : List[String] = app( _ => block )
}
@arun-rama
arun-rama / gist:2771208
Created May 22, 2012 19:48
accessing scala from Java
//App.scala
object App {
def fromString(s:String) : Option[Int] = if( s == "0" ) Some(0) else None
}
//Test.java
public class Test {
public static void main(String[] args){
@arun-rama
arun-rama / gist:2773592
Created May 23, 2012 06:46
Scala Word Count
import java.io.File;
import java.io.IOException;
import java.lang.InterruptedException;
import java.util.StringTokenizer;
import org.apache.commons.io.FileUtils;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
@arun-rama
arun-rama / gist:3036687
Created July 3, 2012 00:46
maven scala config
<build>
<!-- sourceDirectory>src/main/java</sourceDirectory -->
<!-- testSourceDirectory>src/test/java</testSourceDirectory> -->
<pluginManagement>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>