Skip to content

Instantly share code, notes, and snippets.

View DasIch's full-sized avatar

Daniel Neuhäuser DasIch

View GitHub Profile
# coding: utf-8
import os
import random
import inspect
from functools import partial
from itertools import product
class Context(object):
def __init__(self):
while True:
print raw_input("Echo?")
pwhash/tests
├── __init__.py
├── __pycache__
├── test_algorithms.py
├── test_commoncrypto.py
├── test_config.py
├── test_hashers.py
├── test_openssl.py
├── test_packaging
│   ├── __init__.py
# coding: utf-8
"""
pythonic.tests.test_checkers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: 2013 by Daniel Neuhäuser
:license: BSD, see LICENSE.rst for more details
"""
import os
from flask import Flask, request
app = Flask(__name__)
@app.route("/")
def index():
return "<br>".join("%s = %r" % item for item in request.args.items())
@DasIch
DasIch / example.py
Created May 12, 2013 06:20
__prepare__ for Python 2.x
from __future__ import print_function
from collections import OrderedDict
from prepareable import Prepareable
from six import with_metaclass, iteritems
class FooMeta(with_metaclass(Prepareable, type)):
def __new__(cls, name, bases, attributes):
from flask import Flask
from package.db import db
app = Flask(__name__)
db.init_app(app)
[program:apostle]
directory=/var/www/
command=/var/www/env/bin/gunicorn apostle
user=www-data
autostart=True
autorestart=True
redirect_stderr=True
from flask import Flask, stream_with_context, json, Response
app = Flask(__name__)
@app.route('/')
def index():
def gen():
yield json.dumps({'foo': 'spam'})
yield json.dumps({'bar': 'eggs'})
from flask import Flask, url_for
app = Flask(__name__)
@app.route('/', defaults={'page_no': 1})
@app.route('/<int:page_no>')
def main(page_no):
print url_for('main', page_no=2)
return unicode(page_no)