Staging
v0.8.1
Revision f2cbf41afc9e9a0ce16bfe0c71662348453a28c4 authored by Miss Islington (bot) on 06 July 2019, 06:37:38 UTC, committed by Ned Deily on 08 July 2019, 16:43:43 UTC

Also fix a name misspelling.
(cherry picked from commit 45bc61b97178b27ae05bd3eb95481bf0325795bb)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
1 parent 87a918a
Raw File
antigravity.py

import webbrowser
import hashlib

webbrowser.open("https://xkcd.com/353/")

def geohash(latitude, longitude, datedow):
    '''Compute geohash() using the Munroe algorithm.

    >>> geohash(37.421542, -122.085589, b'2005-05-26-10458.68')
    37.857713 -122.544543

    '''
    # https://xkcd.com/426/
    h = hashlib.md5(datedow).hexdigest()
    p, q = [('%f' % float.fromhex('0.' + x)) for x in (h[:16], h[16:32])]
    print('%d%s %d%s' % (latitude, p[1:], longitude, q[1:]))
back to top