Run with Python:
pip-2.7 install cffi
PYTHON=python2.7 sh go.sh
Run with PyPy:
pip-pypy install cffi
PYTHON=pypy sh go.sh
#!/usr/bin/env python | |
# encoding: utf-8 | |
from pprint import pformat, pprint | |
import logging | |
class PasswordMaskingFilter(logging.Filter): | |
"""Demonstrate how to filter sensitive data:""" |
def get_count(q): | |
count_q = q.statement.with_only_columns([func.count()]).order_by(None) | |
count = q.session.execute(count_q).scalar() | |
return count | |
q = session.query(TestModel).filter(...).order_by(...) | |
# Slow: SELECT COUNT(*) FROM (SELECT ... FROM TestModel WHERE ...) ... | |
print q.count() |
curl -X{{ method }} {{ url }} | |
{%- if query_string|length %}?{% endif %} | |
{{- query_string }} \ | |
{%- for header, value in headers.iteritems() %} | |
-H '{{ header|urlencode }}: {{ value|urlencode }}'{% if not loop.last or params|length or auth %} \{% endif %} | |
{%- endfor -%} | |
{% if params|length %}{% for param, value in params.iteritems() %} | |
-d '{{ param.decode('utf-8')|urlencode }}={{ value.decode('utf-8')|urlencode }}'{% if not loop.last or auth %} \{% endif %} | |
{%- endfor %}{%- endif %} | |
{%- if auth %} |
Run with Python:
pip-2.7 install cffi
PYTHON=python2.7 sh go.sh
Run with PyPy:
pip-pypy install cffi
PYTHON=pypy sh go.sh
import uuid | |
import wtforms_json | |
from sqlalchemy import not_ | |
from sqlalchemy.dialects.postgresql import UUID | |
from wtforms import Form | |
from wtforms.fields import FormField, FieldList | |
from wtforms.validators import Length | |
from flask import current_app as app | |
from flask import request, json, jsonify, abort |
When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.
Raw Attribute Strings
<div my-directive="some string" another-param="another string"></div>
This document is obsolete, all the docs for porting are now at https://github.com/mitsuhiko/pocoo-sprint-18052013
========================================== ========================================== | |
TMUX COMMAND WINDOW (TAB) | |
========================================== ========================================== | |
List tmux ls List ^b w | |
New new -s <session> Create ^b c | |
Attach att -t <session> Rename ^b , <name> | |
Rename rename-session -t <old> <new> Last ^b l (lower-L) | |
Kill kill-session -t <session> Close ^b & |
import httplib | |
import urllib2 | |
import ssl | |
import certifi | |
from backports.ssl_match_hostname import match_hostname | |
class CertValidatingHTTPSConnection(httplib.HTTPConnection): | |
default_port = httplib.HTTPS_PORT |