The following gist is an extract of the article Flask-SQLAlchemy Caching. It allows automated simple cache query and invalidation of cache relations through event among other features.
# pulling one User object
user = User.query.get(1)
| #include <time.h> // Robert Nystrom | |
| #include <stdio.h> // @munificentbob | |
| #include <stdlib.h> // for Ginny | |
| #define r return // 2008-2019 | |
| #define l(a, b, c, d) for (i y=a;y\ | |
| <b; y++) for (int x = c; x < d; x++) | |
| typedef int i;const i H=40;const i W | |
| =80;i m[40][80];i g(i x){r rand()%x; | |
| }void cave(i s){i w=g(10)+5;i h=g(6) | |
| +3;i t=g(W-w-2)+1;i u=g(H-h-2)+1;l(u |
| *.cbor | |
| *.log | |
| *.xml | |
| *.yaml | |
| *.json | |
| *.msgpack | |
| *.html | |
| *.marshal | |
| *.pickle | |
| .tox |
The following gist is an extract of the article Flask-SQLAlchemy Caching. It allows automated simple cache query and invalidation of cache relations through event among other features.
# pulling one User object
user = User.query.get(1)
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <unistd.h> | |
| #include <signal.h> | |
| int signaled = 0; | |
| void handler(int ignored) { | |
| signaled = 1; | |
| } |
| import sys | |
| import logging | |
| import argparse | |
| def main(args): | |
| pass | |
| if __name__ == '__main__': | |
| parser = argparse.ArgumentParser( | |
| formatter_class=argparse.ArgumentDefaultsHelpFormatter) |
As configured in my dotfiles.
start new:
tmux
start new with session name:
| import simplejson | |
| import sqlalchemy | |
| from sqlalchemy import String | |
| from sqlalchemy.ext.mutable import Mutable | |
| class JSONEncodedObj(sqlalchemy.types.TypeDecorator): | |
| """Represents an immutable structure as a json-encoded string.""" | |
| impl = String |
| import inspect | |
| import sys | |
| def src(obj): | |
| """Read the source of an object in the interpreter.""" | |
| def highlight(source): | |
| try: | |
| import pygments |
| # Copyright (c) 2010 Curt Micol <asenchi@asenchi.com> | |
| # Permission to use, copy, modify, and distribute this software for any | |
| # purpose with or without fee is hereby granted, provided that the above | |
| # copyright notice and this permission notice appear in all copies. | |
| # THE SOFTWARE IS PROVIDED 'AS IS' AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
| # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
| # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
| # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
| # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |