Skip to content

Instantly share code, notes, and snippets.

View sandeepraju's full-sized avatar

Sandeep Raju Prabhakar sandeepraju

View GitHub Profile
package main
import (
"encoding/base64"
"net/http"
"strings"
)
type handler func(w http.ResponseWriter, r *http.Request)
-- 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,
@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)
@sandeepraju
sandeepraju / cipher_checker.sh
Last active November 12, 2018 21:54
script to test cipher suite using openssl
#!/usr/bin/env bash
# usage: ./cipher_checker google.com 443
# Cipher checker by indiv
# http://superuser.com/a/224263/204745
# OpenSSL requires the port number.
SERVER=$1:$2
DELAY=1
ciphers=$(openssl ciphers 'ALL:eNULL' | sed -e 's/:/ /g')
echo Obtaining cipher list from $(openssl version).
/* Flatten das boostrap */
.well, .navbar-inner, .popover, .btn, .tooltip, input, select, textarea, pre, .progress, .modal, .add-on, .alert, .table-bordered, .nav>.active>a, .dropdown-menu, .tooltip-inner, .badge, .label, .img-polaroid {
-moz-box-shadow: none !important;
-webkit-box-shadow: none !important;
box-shadow: none !important;
-webkit-border-radius: 0px !important;
-moz-border-radius: 0px !important;
border-radius: 0px !important;
border-collapse: collapse !important;
background-image: none !important;
#!/usr/bin/env python
import os
import sys
import hashlib
import pprint
def getSHA1(path):
sha1 = hashlib.sha1()
@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
@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 / 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 &);
}
// 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[])
{