Skip to content

Instantly share code, notes, and snippets.

View rameshvarun's full-sized avatar

Varun Ramesh rameshvarun

View GitHub Profile
@rameshvarun
rameshvarun / configparser.lua
Last active December 17, 2015 23:19
Simple configuration file parser, using a regex.
configfile = [[
ip = 127.0.0.1
tcp port = 10
udp port = 11
lan only = false
]]
config_regex = "%s*(.-)%s*=%s*(.-)%s*\n"
function parseString( data )
@rameshvarun
rameshvarun / mandelbrot.py
Created June 2, 2013 16:45
A python+pygame script that draws the Mandelbrot fractal from right to left. Sample result - http://i.imgur.com/LrtPv09.png
import pygame
import sys
SCREENWIDTH = 800
SCREENHEIGHT = 600
max_iteration = 255
pygame.init()
screen = pygame.display.set_mode((SCREENWIDTH,SCREENHEIGHT),pygame.DOUBLEBUF | pygame.HWSURFACE)
@rameshvarun
rameshvarun / LanguageConfluxer.as
Created June 2, 2013 16:57
ActionScript Language Confluxer, based off of a python script by Christopher Pound. Given a list of names, it will generate random names that sound similar.
//Based off of the python script by Christopher Pound - http://generators.christopherpound.com/
public class LanguageConfluxer
{
var inits:Map = new Map();
var pairs:Map = new Map();
public function LanguageConfluxer()
{
}
@rameshvarun
rameshvarun / raytracer.py
Created June 6, 2013 06:26
A simple ray-tracer written in python with pygame. Writes all frames to an "out" directory. Put ffmpeg in the same directory as the script to save the images to a video.
import pygame
import sys
from math import *
import os
import threading
SCREENWIDTH = 800
SCREENHEIGHT = 600
ASPECT = float(SCREENWIDTH)/float(SCREENHEIGHT)
@rameshvarun
rameshvarun / processTCGA.py
Created June 24, 2013 20:29
Simple script to parse TCGA mRNA data and create a matrix of gene expression information.
import os
#Configuration
DELIM = "\t"
HEADERS = True
TRANSPOSED = True
class Sample:
def __init__(self):
var db = require('./../db')
function getPaths(startnode, endnode,
numpaths, maxdepth,
graphs,
allowcycles,
onresult, onfinish)
{
var results = [];
var depth = 1;
@rameshvarun
rameshvarun / base.html
Last active December 20, 2015 03:39
Turn text areas in Django's admin console into ACE Editors.
{% load admin_static %}<!DOCTYPE html>
<html lang="{{ LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}>
<head>
<title>{% block title %}{% endblock %}</title>
<link rel="stylesheet" type="text/css" href="{% block stylesheet %}{% static "admin/css/base.css" %}{% endblock %}" />
{% block extrastyle %}{% endblock %}
<!--[if lte IE 7]><link rel="stylesheet" type="text/css" href="{% block stylesheet_ie %}{% static "admin/css/ie.css" %}{% endblock %}" /><![endif]-->
{% if LANGUAGE_BIDI %}<link rel="stylesheet" type="text/css" href="{% block stylesheet_rtl %}{% static "admin/css/rtl.css" %}{% endblock %}" />{% endif %}
<script type="text/javascript">window.__admin_media_prefix__ = "{% filter escapejs %}{% static "admin/" %}{% endfilter %}";</script>
{% block extrahead %}{% endblock %}
@rameshvarun
rameshvarun / entrez.r
Last active December 20, 2015 18:29
Scripts used for running SPIA on a data set.
#This script converts the Agilent prob ids to entrez ids
library(gdata)
library(RCurl)
getentrez <- function(hgnc)
{
content = getURLContent( paste0( "http://skimlab.tgen.org:3000/convert?key=", hgnc ) ) #Query conversion server
id = strsplit(content, "\t", fixed=TRUE)[[1]][1] #Get first id returned

Point Charges Simulator

Basic program for simulating the motion of three point charges.

Example Graph

Config Dialog

@rameshvarun
rameshvarun / Scene.cpp
Created December 4, 2014 05:18
Multi-threaded Scene Render.
#include "Scene.h"
#include <fstream>
#include <sstream>
#include <iostream>
#include <vector>
#include <thread>
Scene::Scene()
:currMaterial(NULL),currTexIndex(-1),use_shadow(true),use_transparent_shadow(false),attenuation_coefficient(1.f),camera(NULL),accel_structure(NONE),uniform_grid(NULL)
{