This file contains hidden or 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
SELECT | |
TO_CHAR(NOW(), 'YYYY-MM-DD') || | |
'T' || | |
TO_CHAR(NOW(), 'HH:MM:SS') || | |
'+' || | |
LPAD(EXTRACT(timezone_h from NOW())::TEXT, 2, '0') || | |
':' || | |
LPAD(EXTRACT(timezone_m from NOW())::TEXT, 2, '0') | |
; |
This file contains hidden or 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
def compress_route(route): | |
compressed = [] | |
for point in route: | |
compressed.append(point) | |
if len(compressed) >= 3 and is_collinear(*compressed[-3:]): | |
del compressed[-2] | |
return compressed | |
def is_collinear(a, b, c): |
OlderNewer