Skip to content

Instantly share code, notes, and snippets.

@acedip
acedip / w-to-do.md
Last active August 29, 2015 14:14
Whenisdryday To-Dos
@juanbzpy
juanbzpy / decorator.py
Last active June 1, 2021 20:33
bottle.py basic auth examples
from bottle import route, run, auth_basic
from passlib.hash import sha256_crypt
def check_pass(username, password):
hashed = ''.join(redis.hmget(username, "password"))
return sha256_crypt.verify(password, hashed)
@route('/', method='GET')
@auth_basic(check_pass) # <-- decorator
def index():
@signed0
signed0 / gist:2031157
Created March 13, 2012 19:53
Google Polyline encoder & decoder
'''Provides utility functions for encoding and decoding linestrings using the
Google encoded polyline algorithm.
'''
def encode_coords(coords):
'''Encodes a polyline using Google's polyline algorithm
See http://code.google.com/apis/maps/documentation/polylinealgorithm.html
for more information.