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