Skip to content

Instantly share code, notes, and snippets.

View girish's full-sized avatar

Girish Duvuru girish

  • Google
  • Seattle, WA
View GitHub Profile
@girish
girish / vhost.py
Created February 21, 2014 08:15 — forked from fideloper/vhost.py
#! /usr/bin/python
from sys import argv
from os.path import exists
from os import makedirs
from os import symlink
from os import system
import getopt
#

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@girish
girish / README
Last active August 29, 2015 14:06 — forked from utkarshl/README
In order to use segtree class defined above, you will need to create a datatype(a struct most likely), which will implement the function merge(). It can also additionally implement split, if you need to define the split operation.
A sample is shown as "struct segtree_node" in the code above.
The segtree has to be instantiated with this defined data type. For example,as
segtree<segtree_node> s;
You have to first call the init function of the class, which will take
int n=number of elements in your array,
node[] = your inital array,
identity = an element such that merge(y,identity) = merge(identity,y) = y for all y's.
@girish
girish / introrx.md
Last active August 29, 2015 14:08 — forked from staltz/introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns                     on recent CPU
L2 cache reference ........................... 7 ns                     14x L1 cache
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns                     20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs 4X memory

#! /usr/bin/env python
import fileinput
import argparse
from operator import itemgetter
parser = argparse.ArgumentParser()
parser.add_argument('--target-mb', action = 'store', dest = 'target_mb', default = 61000, type = int)
parser.add_argument('vmtouch_output_file', action = 'store', nargs = '+')
args = parser.parse_args()
/* Javascript Object Model */
/*Please Note that print statements don't exactly print what i say in
comments, they are simplified for simplicity :).
But the idea remains same.
*/
//obj is now an object Phew!!
var obj={}
@girish
girish / lisp.py
Created September 10, 2010 13:41 — forked from pepijndevos/lisp.py
# 5 minutes Lisp in Python
# Pepijn de Vos <http://pepijndevos.nl>
#
# Inspired by 30 minutes Lisp in Ruby
# http://gist.github.com/562017
#
# This Lisp does not read or parse anything at all.
# A generator and a Decorator are abused to run sexps.
#
# Usage:
@girish
girish / lisp.rb
Created September 10, 2010 13:40 — forked from dahlia/lisp.rb
# 30 minutes Lisp in Ruby
# Hong Minhee <http://dahlia.kr/>
#
# This Lisp implementation does not provide a s-expression reader.
# Instead, it uses Ruby syntax like following code:
#
# [:def, :factorial,
# [:lambda, [:n],
# [:if, [:"=", :n, 1],
# 1,
" Conque
" http://www.vim.org/scripts/script.php?script_id=2771
" ~/.vim/after/ftplugin/conque_term.vim
augroup MyConqueTerm
autocmd!
" start Insert mode on BufEnter
autocmd BufEnter *
\ if &l:filetype ==# 'conque_term' |