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 flask import Flask, render_template | |
app = Flask(__name__) | |
def gen_page(page): | |
def endpoint(): | |
return render_template(page, page_name=page) | |
endpoint.__name__ = page |
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 inspect | |
import sys | |
def _get_code_id(callable): | |
if inspect.ismethod(callable): | |
return id(callable.im_func.func_code) | |
elif inspect.isfunction(callable): | |
return id(callable.func_code) |
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
{% if grains.os_family == 'Debian' %} | |
java7_read_license: | |
cmd.run: | |
- name: "echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections" | |
- unless: 'debconf-get-selections | grep "shared/accepted-oracle-license-v1-1"' | |
- require: | |
- pkg: debconf-utils | |
- require_in: | |
- pkg: java7_packages |
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
def recv_future(zmqstream): | |
''' Retruns future for recv on zmqstream | |
''' | |
future = Future() | |
def _finish(reply): | |
future.set_result(reply) | |
zmqstream.on_recv(_finish) |
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 tornado.platform.asyncio import AsyncIOMainLoop | |
import asyncio | |
import tornado | |
import tornado.web | |
import tornado.gen | |
from inspect import isgeneratorfunction, isgenerator | |
AsyncIOMainLoop().install() | |
loop = asyncio.get_event_loop() |
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
"""Deployment tasks using fabric | |
""" | |
import sys | |
from os.path import join, abspath, dirname, expanduser, exists, normpath | |
from fabric.api import prompt, env, sudo, put, task, local, run, cd | |
# from settings import settings | |
from fabric.colors import green, red | |
from shutil import copy |
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
# http://localhost:8888/?mode=sync | |
http://wikipedia.com code: 200 | |
http://google.com code: 200 | |
http://example.com code: 200 | |
#> time curl http://localhost:8888/\?mode\=sync | |
http://wikipedia.com code: 200<br/>http://google.com code: 200<br/>http://example.com code: 200curl http://localhost:8888/\?mode\=sync 0,01s user 0,00s system 0% cpu 1,106 total | |
# http://localhost:8888/?mode=async |
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 socket | |
from tornado.web import Application as BaseApplication | |
from tornado.options import define, options, parse_command_line | |
class Application(BaseApplication): | |
def listen(self, port, address="", **kwargs): | |
if options.fd: |
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
diff --git a/circus/process.py b/circus/process.py | |
index 070cb10..f7cb699 100644 | |
--- a/circus/process.py | |
+++ b/circus/process.py | |
@@ -124,7 +124,7 @@ class Process(object): | |
if self.uid: | |
os.setuid(self.uid) | |
- self._worker = Popen(args, cwd=self.working_dir, | |
+ self._worker = Popen(args, bufsize=-1, cwd=self.working_dir, |
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
diff --git a/circus/process.py b/circus/process.py | |
index 070cb10..f7cb699 100644 | |
--- a/circus/process.py | |
+++ b/circus/process.py | |
@@ -124,7 +124,7 @@ class Process(object): | |
if self.uid: | |
os.setuid(self.uid) | |
- self._worker = Popen(args, cwd=self.working_dir, | |
+ self._worker = Popen(args, bufsize=-1, cwd=self.working_dir, |