Skip to content

Instantly share code, notes, and snippets.

View rameshvarun's full-sized avatar

Varun Ramesh rameshvarun

View GitHub Profile
@rameshvarun
rameshvarun / starsystem.rs
Created December 7, 2022 08:01
Keplerian Orbital Elements Simulation in Rust.
use na::Vector3;
use std::f64::consts::{PI};
const TICK_TIMESTEP: f64 = 86400.0;
const GM: f64 = 1.32712440042e20;
#[derive(Clone, Debug)]
pub struct OrbitalElements {
let x = 0;
// WORKS
Math.random()
Date.now()
function test_false() {
if (false) {
return x++;
}
@rameshvarun
rameshvarun / plot-sleep-schedule.py
Last active May 17, 2021 22:39
Plot FitBit sleep schedule using Matplotlib.
#!/usr/bin/env python3
import glob
import csv
import itertools
from datetime import datetime, timedelta, time
from collections import namedtuple
import numpy as np
import matplotlib.pyplot as plt
@rameshvarun
rameshvarun / litlua.lua
Last active July 31, 2021 03:27
Basic literate programming in Lua.
local litlua = {}
-- String split function - taken from Penlight
-- https://github.com/stevedonovan/Penlight/blob/master/lua/pl/utils.lua#L172
local function split(s, re, plain, n)
local i1, ls = 1, {}
if not re then re = '%s+' end
if re == '' then return {s} end
while true do
local i2, i3 = s:find(re, i1, plain)
@rameshvarun
rameshvarun / HTTP2 Streaming RPC.md
Last active August 29, 2019 18:59
How the HTTP2 API could be used to implement a streaming RPC more easily than other transport layers.

HTTP2 Streaming RPC

Output

Server

RPC from client to FindInProjectService/search
Sending search update.
Sending search update.
RPC from client to FindInProjectService/search
Sending search update.
@rameshvarun
rameshvarun / set_iptables.sh
Last active August 29, 2015 14:19
IP Tables Configurations
#!/bin/bash
# Flush all current rules
iptables -F
# Accept SSH Connections
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -P INPUT DROP # By default, drop all incoming connections
iptables -P FORWARD DROP # By default refuse to forward packets
@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)
{

Point Charges Simulator

Basic program for simulating the motion of three point charges.

Example Graph

Config Dialog

@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
@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 %}