This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from wsgiref.simple_server import make_server | |
| from wsgiref.util import application_uri | |
| import sys | |
| import json | |
| def home(): | |
| return 'hello world' | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Pyramid 1.5 and lower | |
| Name Pattern View | |
| ---- ------- ---- | |
| debugtoolbar /_debug_toolbar/*subpath <function decorator at 0x349a398> | |
| __static/ /static/*subpath <function <pyramid.static.static_view object at 0x3421890> at 0x349a758> | |
| __static2/ /static2/*subpath <function <pyramid.static.static_view object at 0x3421950> at 0x349a9b0> | |
| __pdt_images/ /pdt_images/*subpath <function <pyramid.static.static_view object at 0x3421a50> at 0x349ab90> | |
| a / None | |
| no_view_attached / None | |
| route_and_view_attached / <function route_and_view_attached at 0x349f050> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| import StringIO | |
| import urlparse | |
| import cgi | |
| from docutils import io, readers | |
| from docutils.core import publish_doctree, Publisher | |
| from docutils.transforms import TransformError | |
| ALLOWED_SCHEMES = '''file ftp gopher hdl http https imap mailto mms news nntp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DESCRIBE schema | |
| CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = true; | |
| CREATE TABLE test.response ( | |
| survey_id int, | |
| hour_created int, | |
| respondent_id int, | |
| date_created text, | |
| date_deleted text, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Tracing session: 43c34fb0-f054-11e4-8ca4-b9a936855b1e | |
| activity | timestamp | source | source_elapsed | |
| ---------------------------------------------------------------------------------------------------------+----------------------------+---------------+---------------- | |
| Execute CQL3 query | 2015-05-01 15:49:03.275000 | 10.128.36.179 | 0 | |
| Parsing select * from hour_response where survey_id=100326883 and hour_created=1; [SharedPool-Worker-1] | 2015-05-01 15:49:03.277000 | 10.128.36.179 | 110 | |
| Preparing statement [SharedPool-Worker-1] | 2015-05-01 15:49:03.277000 | 10.128.36.179 | 275 | |
| Sending message to /10.128.36.193 [WRITE-/10.128.36.193] | 2015-05-01 15:49:03.278000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from datetime import datetime | |
| now = datetime.utcnow() | |
| t = now.timestamp() | |
| t2 = datetime.utcfromtimestamp(t) | |
| assert now == t2, 'Why no work?' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.views.generic.base import TemplateResponseMixin | |
| from django.views.generic.base import View | |
| class SomeFormView(TemplateResponseMixin, View): | |
| template_name = 'some_form.html' | |
| def get(self, request): | |
| form = SomeForm() | |
| return self.render_to_response({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| :%s/${\([^}]*\)}/{{ \1 }}/g | |
| :%s/% if\([^:]*\):/{% if\1 %}/g | |
| :%s/% endif/{% endif %}/g | |
| :%s/% else:/{% else %}/g | |
| :%s/% for\([^:]*\):/{% for\1 %}/g | |
| :%s/% endfor/{% endfor %}/g |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Ruby style string interpolation with a giant bag of evil python. | |
| import inspect | |
| class __(str): | |
| def __init__(self, other): | |
| super(__, self).__init__(other) | |
| def __invert__(self): | |
| frame = inspect.currentframe() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # run if user hits control-c | |
| control_c() | |
| { | |
| echo "Oh no, exiting!" | |
| for pid in $(cat gunicorn.pid) | |
| do | |
| echo "killing $pid" | |
| kill -SIGKILL $pid | |
| done |
OlderNewer