This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def cons(list, count): | |
if count <= 0: | |
count = 1 | |
for i in range(len(list) - count + 1): | |
yield list[i: i+count] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/base64" | |
"net/http" | |
"strings" | |
) | |
type handler func(w http.ResponseWriter, r *http.Request) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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), [email protected] | |
#=============================================================================== | |
set -o nounset # Treat unset variables as an error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"crypto/rand" | |
"encoding/binary" | |
) | |
func randUInt32() (uint32, error) { | |
bytes := make([]byte, 4) | |
_, err := rand.Read(bytes) | |
return binary.BigEndian.Uint32(bytes), err | |
} |
OlderNewer