Skip to content

Instantly share code, notes, and snippets.

View dotslash's full-sized avatar
🍊
🍒

Sai Teja Suram dotslash

🍊
🍒
View GitHub Profile
#define _all5 0x55555555
#define _all3 0x33333333
#define _all0F 0x0F0F0F0F
#define _all01 0x01010101
#define _to64(x) (((long long)x)<<32 + x)
int NumberOfSetBits64(long long i)
{
i = i - ((i >> 1) & _to64(_all5));
i = (i & _to64(_all3)) + ((i >> 2) & _to64(_all3));
@dotslash
dotslash / Main.scala
Last active December 15, 2015 06:49
Scala Template
import java.io._
import java.util._
import java.math._
class InputReader(stream: InputStream)
{
val br : BufferedReader = new BufferedReader(new InputStreamReader(stream))
var tokenizer : StringTokenizer = null
@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>

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname

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:

##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.

@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));;
@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 / 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

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: