- Open World
- Car-Shooter
from __future__ import print_function | |
from difflib import SequenceMatcher | |
def mean(numbers): | |
""" | |
Returns the arithmetic mean of a numeric list. | |
see: http://mail.python.org/pipermail/python-list/2004-December/294990.html | |
""" | |
return float(sum(numbers)) / float(len(numbers)) |
public class LostMobile extends Activity { | |
// [... snip ...] | |
mMainRecycler = (RecyclerView) findViewById(R.id.mainList); | |
mMainRecycler.setHasFixedSize(true); | |
mMainRecycler.setLayoutManager(new LinearLayoutManager(this)); | |
mMainListAdapter = new MyAdapter(this, remoteMap); | |
// [... snip ...] | |
mMainRecycler.setAdapter(mMainListAdapter); |
[Groups] | |
NumberOfGroups = 9 | |
[1] | |
TriggerTop = [Monitor1Top] | |
TriggerRight = [Monitor1Left] + [Monitor1Width] / 3 | |
TriggerBottom = [Monitor1Bottom] | |
TriggerLeft = [Monitor1Left] | |
[2] |
#!/bin/bash | |
# | |
# Script to find lingering PostgreSQL data files. | |
# | |
# Those files can usually be safely removed from disk. | |
# | |
# Use at your own risk! | |
# | |
# Based on http://dba.stackexchange.com/a/121876/34652 |
When using a non-standard id attribute, flask-login does not seem to work. See also pallets-eco/flask-security-3.0#472
This gist contains two examples. One is working, the other one isn't. To test, run the app and go to http://localhost:5000
Login: [email protected] Password: admin
When using working.py
, you should see an 'OK' message.
When using broken.py
the login will simply not work, and you'll be presented with a new login page.
from time import sleep | |
import logging | |
LOG = logging.getLogger(__name__) | |
def every_5_seconds(): | |
LOG.info('Running every 5') | |
I hereby claim:
- I am exhuma on github.
- I am exhuma (https://keybase.io/exhuma) on keybase.
- I have a public key whose fingerprint is 033C FABB FBCE 2387 C88D E243 8C72 CFB3 4D7E BB44
To claim this, I am signing this object:
I've tried upgrading from Flask 0.10.1 to 0.12 today and ran into a little issue:
I am maintaining a larger application which also provides a JSON API on top of a subset of it's functionalities via Flask. In order to make error handling consistent I defined a simple mixin class:
class RestExceptionMixin(object):
"""
Mixin for exceptions which can be used in a REST API.
"""
status_code = 400
import logging | |
import re | |
P_REQUEST_LOG = re.compile(r'^(.*?) - - \[(.*?)\] "(.*?)" (\d+) (\d+|-)$') | |
LOG = logging.getLogger('werkzeug') | |
def colorize_werkzeug(): |