This file contains 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
""" | |
Expands `${MY_VAR}` variables in a given dictionary from `os.environ` and | |
local INI-like file. | |
""" | |
import os | |
def load_secrets(filename): | |
""" |
This file contains 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
aa.je | |
ae.je | |
ae.gg | |
ae.ht | |
af.je | |
af.cx | |
af.gg | |
af.gl | |
af.ht | |
ah.je |
This file contains 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
""" | |
Moves db rows one by one, from source db (configured using pyramid ini config) | |
to destination db defined as engine here. | |
""" | |
from sqlalchemy import create_engine | |
from sqlalchemy.orm import sessionmaker | |
from pyramid.paster import bootstrap | |
bootstrap('development.ini') # bootstrap pyramid's environment along with data models |
This file contains 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
# Worker fails here if it closes, creates and uses the same loop | |
# for its runner and apps code it's serving. | |
# | |
# Start with: gunicorn -w 2 aiohttp_gunicorn_worker_test:app --worker-class aiohttp.worker.AsyncGunicornWorker | |
import asyncio | |
import aiohttp | |
@asyncio.coroutine |
This file contains 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
# coding=UTF-8 | |
from __future__ import division | |
import re | |
# This is a naive text summarization algorithm | |
# Created by Shlomi Babluki | |
# April, 2013 | |
class SummaryTool(object): |
This file contains 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
def create_pyramid(body, headers): | |
from pyramid.response import Response | |
from pyramid.config import Configurator | |
def hello(request): | |
return Response(body, headers=headers, content_type='text/plain') | |
config = Configurator() | |
config.add_route('hello', '/hello/:account_id/test') |