Skip to content

Instantly share code, notes, and snippets.

Tony Blundell tonyblundell

View GitHub Profile
@tonyblundell
tonyblundell / docker-compose.yml
Created Oct 5, 2018
Golang docker-compose.yml
View docker-compose.yml
version: "3"
services:
app:
image: golang:alpine
working_dir: /app
volumes:
- .:/app
command: sh -c "go fmt && go run main.go"
@tonyblundell
tonyblundell / distance.sql
Created Sep 29, 2014
SQL lat/long distance(mi) calc
View distance.sql
3959 * ACOS(COS(RADIANS(lat1)) * COS(RADIANS(lat2)) *
COS(RADIANS(long2) - RADIANS(long1)) +
SIN(RADIANS(lat1)) * SIN(RADIANS(lat2)))
@tonyblundell
tonyblundell / ago.py
Created May 10, 2012
ago: Calculate a '3 hours ago' type string from a python datetime.
View ago.py
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,
You can’t perform that action at this time.