antigravity.py 500 B

1234567891011121314151617
  1. import webbrowser
  2. import hashlib
  3. webbrowser.open("https://xkcd.com/353/")
  4. def geohash(latitude, longitude, datedow):
  5. '''Compute geohash() using the Munroe algorithm.
  6. >>> geohash(37.421542, -122.085589, b'2005-05-26-10458.68')
  7. 37.857713 -122.544543
  8. '''
  9. # https://xkcd.com/426/
  10. h = hashlib.md5(datedow, usedforsecurity=False).hexdigest()
  11. p, q = [('%f' % float.fromhex('0.' + x)) for x in (h[:16], h[16:32])]
  12. print('%d%s %d%s' % (latitude, p[1:], longitude, q[1:]))