Skip to content

Instantly share code, notes, and snippets.

View VijayKrishna's full-sized avatar
🍊
Working from home

Vijay Krishna Palepu VijayKrishna

🍊
Working from home
View GitHub Profile
@VijayKrishna
VijayKrishna / index.html
Created March 18, 2013 03:26
Keys n Bars
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.chart rect {
stroke: white;
fill: steelblue;
}
</style>
@VijayKrishna
VijayKrishna / README.md
Last active December 15, 2015 01:49
Twinkling Stars

This d3js visualization tries to capture the twinkling of stars or node of a force directed graph with a simple animation to change the color and size of the nodes or stars.

@VijayKrishna
VijayKrishna / lambda.ss
Last active December 15, 2015 01:29
Simple Lambda Interpreter
;;UCI Class Project - INF212 Analysis of Programming Languages
;;Nicholas DiGiuseppe and Vijay Krishna Palepu
;;1.interpreter is not case sensitive.
;;2.interpreter lives in the world of symbols and lists.
;;3.interpreter requires proper parenthesis.
;;4.does not work with numbers such as 1 2 3...
;;reference: http://matt.might.net/articles/implementing-a-programming-language/
;;original 7 lines
; eval takes an expression and an environment to a value
@VijayKrishna
VijayKrishna / JavaC.sublime-build
Created March 17, 2013 05:32
Sublime Text 2 Java Build file
{
"cmd": ["javac", "-Xlint", "$file"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.java",
"variants": [
{ "cmd": ["javac", "-Xlint", "$file"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.java",
@VijayKrishna
VijayKrishna / Multicolor_Grouped_Boxplot.m
Created March 17, 2013 05:34
Plotting Box-plots in Groups for Vectors of Varying Lengths
x = [1,2,3,4,5,1,2,3,4,6];
group = [1,1,2,2,2,3,3,3,4,4];
positions = [1 1.25 2 2.25];
boxplot(x,group, 'positions', positions);
color = ['y', 'y', 'c', 'c'];
h = findobj(gca,'Tag','Box');
for j=1:length(h)
patch(get(h(j),'XData'),get(h(j),'YData'),color(j),'FaceAlpha',.5);
end
@VijayKrishna
VijayKrishna / DescSplitter.java
Created March 17, 2013 05:31
Method descriptor parser
public class DescSplitter {
public static void main(String[] args) {
splitMethodDesc(desc);
//simple test cases.
splitMethodDesc("([IFB[[[[[Ljava/lang/String;Ljava/lang/String;[I[S[BBLjava/lang/BLtring;)");
splitMethodDesc("Ljava/lang/String;BBBBLjava/lang/String;");
splitMethodDesc("ZBCSIFDJ[Z[B[C[S[I[F[D[JLZBCSIFDJ;LZBCSIFDJ;[LZBCSIFDJ;LZBCSIFDJ;[LZBCSIFDJ;");
}
public static void splitMethodDesc(String desc) {
@VijayKrishna
VijayKrishna / Driver.java
Created March 17, 2013 05:29
Frames Stack information
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.commons.AnalyzerAdapter;
@VijayKrishna
VijayKrishna / README.md
Last active December 15, 2015 01:29
Simple WordCloud

Simple word cloud based on a force directed layout using the d3js.org

@VijayKrishna
VijayKrishna / Goto.java
Created March 18, 2015 08:40
The embarassing existence of unconditional jumps (read goto's) in Java. It (goto) is like a zombie that refuses to just die.
public class Goto {
public static void main(String[] args) {
int count = 0;
Goto:
for(int i = 0; i < 10; i +=1) {
for(int j = 0; j < 10; j += 1) {
System.out.println("hello" + count++);
break Goto;
}
public static double entropy(List<? extends Comparable> values) {
final Map<Comparable, Long> valueOccurances = new HashMap<Comparable, Long>();
for (Comparable value : values) {
Long valueOccurance = valueOccurances.get(value);
valueOccurances.put(value, valueOccurance == null ? 1L : ++valueOccurance);
}
double combinedEntropy = 0.0d;