Skip to content

Instantly share code, notes, and snippets.

View sillyfellow's full-sized avatar
:octocat:
Why be normal?

Sandeep Sadanandan sillyfellow

:octocat:
Why be normal?
View GitHub Profile
In Silver Blaze, Holmes and Watson are on a train going to Exeter.
Holmes has been reading all that the papers have to say about the
disappearance of the horse, Silver Blaze. Apparently satisfied, he
thrusts the papers under the seat and comments to Watson:
“We are going well,” said he, looking out of the window, and glancing at
his watch. “Our rate at present is fifty-three and a half miles an
hour.”
“I have not observed the quarter-mile posts,” said I.
@sillyfellow
sillyfellow / drive.py
Last active August 29, 2015 14:08 — forked from basuke/drive.py
#
# python drive.py "origin" ["waypoint" ... ] "destination"
#
# i.e. python drive.py "Union Square, San Francisco" "Ferry Building, San Francisco" 'Bay Bridge' SFO
import sys, json, urllib2, md5, os.path, pprint
from math import radians, sin, cos, atan2, pow, sqrt
from urllib import quote_plus
from xml.sax.saxutils import escape
from optparse import OptionParser
def cons(list, count):
if count <= 0:
count = 1
for i in range(len(list) - count + 1):
yield list[i: i+count]
#!/usr/bin/python
import numpy as np
from random import randint
def gen_points(a, b, num_divisions):
if num_divisions == 0:
return [a]
xdiff = b[0] - a[0]
ydiff = b[1] - a[1]
@sillyfellow
sillyfellow / count_android_methods.rb
Last active September 17, 2015 07:18 — forked from toms972/count_android_methods.rb
Android environment has a limitation of maximum 65536 methods definition Here is a ruby script that helps to count the number of methods per each jar.
#!/usr/bin/env ruby
class CountAndroidMethods
def count(path)
full_folder_path = File.expand_path(path)
total_count = 0
# Traverse the folder
Dir.entries(full_folder_path).each {|file|
#!/usr/bin/python3
import csv
import json
import urllib.request
import urllib.parse
from time import sleep
def parse_json_response(response):
content = response.readall().decode('utf-8')
@sillyfellow
sillyfellow / auth.go
Created January 21, 2016 15:10 — forked from tristanwietsma/auth.go
Golang web server example
package main
import (
"encoding/base64"
"net/http"
"strings"
)
type handler func(w http.ResponseWriter, r *http.Request)
#!/bin/bash -
#===============================================================================
# FILE: Mind Trainder
# USAGE: ./mind_trainer.sh
#
# DESCRIPTION: Train your mind to quickly find your income as a freelancer.
# AUTHOR: Dr. Sandeep Sadanandan (sillyfellow), grep@whybenormal.org
#===============================================================================
set -o nounset # Treat unset variables as an error
@sillyfellow
sillyfellow / time_in_words.js
Last active May 9, 2016 12:50
Poor man's descriptive time stuff
function pluralize(count, name) {
var suffix = (count == 1) ? "" : "s"
return count + name + suffix
};
function secondsToDescriptiveTime(seconds) {
var DAYCOUNT = 86400
var HOURCOUNT = 3600
var MINUTECOUNT = 60
import (
"crypto/rand"
"encoding/binary"
)
func randUInt32() (uint32, error) {
bytes := make([]byte, 4)
_, err := rand.Read(bytes)
return binary.BigEndian.Uint32(bytes), err
}