Skip to content

Instantly share code, notes, and snippets.

dropbox
http://www.dropbox.com/jobs/challenges
greplin
http://challenge.greplin.com/
facebook
http://www.facebook.com/careers/puzzles.php
quora
@yashk
yashk / locate_jar.java
Created May 31, 2011 15:11
loaction of jar file a class is loaded from
Class cls = this.getClass();
ProtectionDomain pDomain = cls.getProtectionDomain();
CodeSource cSource = pDomain.getCodeSource();
URL loc = cSource.getLocation(); // file:/c:/almanac14/examples/
@yashk
yashk / gist:1112474
Created July 28, 2011 20:29
recursively delete CVS directories
find . -depth -name 'CVS' -exec rm -rf '{}' \; -print
@yashk
yashk / gist:1132548
Created August 8, 2011 19:48
zip file older than n days
-ctime The time the file's status last changed -- in number of days.
find . -ctime 2 | zip ~/5_aug_ccfLogs.zip -@
@yashk
yashk / about.md
Created August 15, 2011 12:48 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@yashk
yashk / epc.sh
Created December 7, 2011 21:59
sysmili sec date to human redable date
d=$(echo "$1/1000" | bc); date -d@$d
# usange epc.sh 1323350683861
#Thu Dec 8 08:24:43 EST 2011
@yashk
yashk / gist:1452407
Created December 9, 2011 17:07
get current schema from db - oracle
select sys_context( 'userenv', 'current_schema' ) from dual;
@yashk
yashk / gist:1965296
Created March 3, 2012 10:01 — forked from jbrisbin/gist:1444077
Reactor-based framework versus Node.js streaming

I've been hacking away recently at a JVM framework for doing asynchronous, non-blocking applications using a variation of the venerable Reactor pattern. The core of the framework is currently in Java. I started with Scala then went with Java and am now considering Scala again for the core. What can I say: I'm a grass-is-greener waffler! :) But it understands how to invoke Groovy Closures, Scala anonymous functions, and Clojure functions, so you can use the framework directly without needing wrappers.

I've been continually micro-benchmarking this framework because I feel that the JVM is a better foundation on which to build highly-concurrent, highly-scalable, C100K applications than V8 or Ruby. The problem has been, so far, no good tools exist for JVM developers to leverage the excellent performance and manageability of the JVM. This yet-to-be-publicly-released framework is an effort to give Java, Groovy, Scala, [X JVM language] developers access to an easy-to-use programming model that removes the necessity

@yashk
yashk / gist:1965297
Created March 3, 2012 10:02 — forked from jbrisbin/gist:1444077
Reactor-based framework versus Node.js streaming

I've been hacking away recently at a JVM framework for doing asynchronous, non-blocking applications using a variation of the venerable Reactor pattern. The core of the framework is currently in Java. I started with Scala then went with Java and am now considering Scala again for the core. What can I say: I'm a grass-is-greener waffler! :) But it understands how to invoke Groovy Closures, Scala anonymous functions, and Clojure functions, so you can use the framework directly without needing wrappers.

I've been continually micro-benchmarking this framework because I feel that the JVM is a better foundation on which to build highly-concurrent, highly-scalable, C100K applications than V8 or Ruby. The problem has been, so far, no good tools exist for JVM developers to leverage the excellent performance and manageability of the JVM. This yet-to-be-publicly-released framework is an effort to give Java, Groovy, Scala, [X JVM language] developers access to an easy-to-use programming model that removes the necessity

@yashk
yashk / ex2.scala
Created May 31, 2012 19:01
scala for impatient exercise chapter 2
/*1. The signum of a number is 1 if the number is positive, –1 if it is negative, and
0 if it is zero. Write a function that computes this value.
*/
def signum(x: Int): Int = if(x>0) 1 else -1
/*
4. Write a Scala equivalent for the Java loop
for (int i = 10; i >= 0; i--) System.out.println(i);
*/