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
version: "3" | |
services: | |
app: | |
image: golang:alpine | |
working_dir: /app | |
volumes: | |
- .:/app | |
command: sh -c "go fmt && go run main.go" |
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
3959 * ACOS(COS(RADIANS(lat1)) * COS(RADIANS(lat2)) * | |
COS(RADIANS(long2) - RADIANS(long1)) + | |
SIN(RADIANS(lat1)) * SIN(RADIANS(lat2))) |
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 datetime | |
def ago(t): | |
""" | |
Calculate a '3 hours ago' type string from a python datetime. | |
""" | |
units = { | |
'days': lambda diff: diff.days, | |
'hours': lambda diff: diff.seconds / 3600, | |
'minutes': lambda diff: diff.seconds % 3600 / 60, |