This file contains hidden or 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
# Clustering with Lance-Williams updating formula | |
# http://ibisforest.org/index.php?Lance-Williams%20updating%20formula | |
calcSquare = (n) -> n * n | |
haversine = (lat1, lng1, lat2, lng2) -> | |
6371000 * 2 * Math.asin(Math.sqrt(Math.pow(Math.sin((lat1 - Math.abs(lat2)) * Math.PI / 180 / 2), 2) + Math.cos(Math.abs(lat1) * Math.PI / 180 ) * Math.cos(Math.abs(lat2) * Math.PI / 180) * Math.pow(Math.sin((lng1 - lng2) * Math.PI / 180 / 2), 2) )) | |
## | |
# calculate distance between 2 numbers |
This file contains hidden or 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 python | |
#coding:utf-8 | |
# Exchange usd to any currency, or any currency to usd | |
# help: python convert_usd.py -h | |
import os.path | |
from datetime import date, datetime | |
import argparse | |
import urllib |
NewerOlder