Skip to content

Instantly share code, notes, and snippets.

View dotslash's full-sized avatar
🍊
🍒

Sai Teja Suram dotslash

🍊
🍒
View GitHub Profile
@dotslash
dotslash / twitter-disclaimer.md
Last active July 27, 2016 07:11
Twitter disclaimer - yesteapea
@dotslash
dotslash / rec-stack.py
Created April 15, 2016 07:36
Examples for my post on converting recursion to stack
def hanoi(n, fr, to, buf):
if (n == 0):
return
#print "deb", 'l', n, fr, to, buf
hanoi(n-1, fr, buf, to)
#print "deb", 'r', n, fr, to, buf
print "{} {}->{}".format(n, fr, to)
hanoi(n-1, buf, to, fr)
def hanoi_iter(n, fr, to, buf):

Keybase proof

I hereby claim:

  • I am dotslash on github.
  • I am yesteapea (https://keybase.io/yesteapea) on keybase.
  • I have a public key whose fingerprint is 178F E423 0A4A 1F23 8504 0E16 992C C2CD 1B3E 2324

To claim this, I am signing this object:

@dotslash
dotslash / find_parent.lua
Last active April 19, 2017 20:17
Redis lua graph traversal
--"9e4c3550b2961d085916ecdead255cde6b450f6b"
local ret = KEYS[1]
local limit = 100
while limit ~= 0 do
local pres = redis.pcall("GET", ret)
if pres == nil or type(pres) == "boolean" then return ret end
ret = pres
limit = limit - 1
end
return ret
@dotslash
dotslash / README
Last active August 29, 2015 14:14 — 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.
@dotslash
dotslash / IO.java
Last active August 29, 2015 14:14 — forked from anonymous/IO.java
java snippets
package reuse;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
final class IO{
//Standard IO
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));;

##Why I quit fb

####Waiting for a trigger I was super super active on fb. I could not resist my self from not sharing anything remotely interesting. I like to poke others on their posts and find out flaws in the what others write. It used to take 3-4 hours of my day easily. I used to hate this. I always wanted to get out of facebook, but could not because there is no push and was a little scared of losing out many contacts.

####Here comes the trigger My question on FB forums on what happened

On 27th august while playing around with FB's official android app, I clicked something and all my work contacts (includes >mailing lists, CEO, CTO and a never ending list of contacts in my mail) got invites to facebook from me.

>I thought this was over. But again on 12 Sept without any action from my side the same happened again. This time facebook sent reminders to the same contacts to connect with me.

Keybase proof

I hereby claim:

  • I am dotslash on github.
  • I am yesteapea (https://keybase.io/yesteapea) on keybase.
  • I have a public key whose fingerprint is 62A7 9F1A 0085 D199 D692 0854 99D4 F20A 50CA 42C4

To claim this, I am signing this object:

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@dotslash
dotslash / template.cpp
Created March 22, 2013 05:45
c++ template
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <cmath>
#include <string>
#include <iostream>
#include <algorithm>