Skip to content

Instantly share code, notes, and snippets.

View sandeepraju's full-sized avatar

Sandeep Raju Prabhakar sandeepraju

View GitHub Profile
@sandeepraju
sandeepraju / dustbin.r
Created January 2, 2015 13:29
Average distance travel to access the dustbin
# author - @edbidangi
# https://twitter.com/edbidangi/status/550997127074045952
library(rgl)
dist <- function(x1, y1, x2, y2) {
return(sqrt( (x2 - x1)**2 + (y2 - y1)**2 ))
}
width = 20
height = 20
distances = matrix(nrow = height, ncol = width)
-- Display table and index sizes
SELECT
table_name,
pg_size_pretty(table_size) AS table_size,
pg_size_pretty(indexes_size) AS indexes_size,
pg_size_pretty(total_size) AS total_size
FROM (
SELECT
table_name,
pg_table_size(table_name) AS table_size,
package main
import (
"encoding/base64"
"net/http"
"strings"
)
type handler func(w http.ResponseWriter, r *http.Request)
// pointer dereference - differences
package main
import "fmt"
type User struct {
name string
email string
}
$ ssh -A vm
$ git config --global url."git@github.com:".insteadOf "https://github.com/"
$ cat ~/.gitconfig
[url "git@github.com:"]
	insteadOf = https://github.com/
$ go get github.com/private/repo && echo Success!
Success!
// This file is a part of 'helloworld' project
// Copyright (c) 2012 by Sandeep Raju <sandeeprajup@gmail.com>
// Title : Program to print 'hello, world'
// Created : 20.06.2012 | Wednesday
// Author : Sandeep Raju <sandeeprajup@gmail.com>
#include <iostream>
int main(int argc, char* argv[])
{
@sandeepraju
sandeepraju / sublime_function.sh
Created August 22, 2012 19:46
sublime function for .bashrc
function sublime()
{
(/location/of/sublimetext2/folder/sublime_text "$@" > /dev/null 2> /dev/null &);
}
@sandeepraju
sandeepraju / distribution.py
Created October 14, 2012 07:02
Probability Distribution
#!/usr/bin/python
import pylab
import random
import math
def uniform():
result = {}
hist = []
a = 100
@sandeepraju
sandeepraju / saytime.py
Created November 30, 2012 17:33
Time teller python script
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import os
def main():
baseStr = "'The time is, "
currentTime = time.localtime()
currentHour = currentTime.tm_hour
#!/usr/bin/env python
import os
import sys
import hashlib
import pprint
def getSHA1(path):
sha1 = hashlib.sha1()