View main.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code from https://lethain.com/genetic-algorithms-cool-name-damn-simple
"""
from random import randint, random
from operator import add
View log_exceptions.py
import traceback
from functools import wraps
def log_exceptions(fd):
def _wrapped(func):
@wraps(func)
def _func(*args, **kwargs):
try:
return func(*args, **kwargs)
except Exception:
View check_names.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from GeoBases import GeoBase
def main():
g = GeoBase('ori_por', verbose=False)
for p in g:
View generate_optd_por_tz.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from GeoBases import GeoBase
import pytz
def load_best_known(filename):
with open(filename) as f:
View fix_tz.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from GeoBases import GeoBase
import pytz
def pors_with_unk_tz(db_oripor):
for p in db_oripor:
p_tz = db_oripor.get(p, 'timezone')
View prettify.py
#!/usr/bin/python
"""
Some prettification functions.
>>> humanize(1024, is_bytes=True)
'1.0 kB'
>>> humanize(1000*12342)
'12.3 M'
>>> pretty_num(1255000)
View stat_functions.py
#!/usr/bin/python
"""
Some stats functions::
>>> mean([1, 2, 6])
3.0
>>> variance([1, 2, 6], bias=True)
4.666666...
View run_times_from_pace.py
#!/usr/bin/env python
"""
Simple converter from pace to reference times
for runners.
$ ./run_times_from_pace.py 4:15 -d 1.0
1.00km in 0:04:15 gives you:
1km: 0:04:15 ( 1.00km)
View geobases_custom_map.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Drawing some lines between airports on a map.
"""
from GeoBases import GeoBase
def main():
View flask_over_geobases.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Webservice over GeoBases using Flask.
"""
# Flask is a microframework web
from flask import Flask, request, jsonify