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
import wrapt | |
class NotFlask(): | |
def __init__(self): | |
self.routes = {} | |
#def route(self, route_str): | |
#@wrapt.decorator | |
#def decorator(f, instance, args, kwargs): | |
#self.routes[route_str] = f |
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
from contextlib import contextmanager | |
import sys | |
@contextmanager | |
def export(): | |
print "Enter:" | |
yield | |
print sys._getframe(2).f_locals | |
print "Exit" |
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
# Part of a package named foo. | |
__all__ = [] | |
def export(defn): | |
"""Decorator to explicitly mark functions that are exposed in a lib.""" | |
globals()[defn.__name__] = defn | |
__all__.append(defn.__name__) | |
return defn |
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
set -g -x PATH $HOME/bin /usr/local/bin $PATH /usr/X11/bin | |
set -g -x TERM xterm-256color | |
# Rbenv settings | |
set -gx RBENV_ROOT /usr/local/var/rbenv | |
. (rbenv init -|psub) | |
# Docker boot2docker | |
set -g -x DOCKER_CERT_PATH /Users/amjith/.boot2docker/certs/boot2docker-vm | |
set -g -x DOCKER_TLS_VERIFY 1 |
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
Traceback (most recent call last): | |
File "/usr/local/bin/pip", line 5, in <module> | |
from pkg_resources import load_entry_point | |
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 2912, in <module> | |
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 550, in _build_master | |
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 563, in _build_from_requirements | |
keys2.append(dist.key) | |
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 742, in resolve |
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
import newrelic.agent | |
newrelic.agent.initialize('staging.ini') | |
newrelic.agent.register_application(timeout=10.0) | |
def add(a, b): | |
return a + b | |
def sub(a, b): | |
return a - b |
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
from __future__ import print_function | |
import base64 | |
import six | |
#def _encode(name, key): | |
#s = [] | |
#for i in range(len(name)): | |
#s.append(chr(ord(name[i]) ^ ord(key[i % len(key)]))) | |
#return s |
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
from time import sleep | |
from webtest import TestApp | |
import newrelic.agent | |
newrelic.agent.initialize('newrelic.ini') | |
def hello_world(environ, start_response): | |
path = environ.get('PATH_INFO') | |
if path.startswith('/slow'): |
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
import tornado.ioloop | |
import tornado.web | |
import os | |
HERE = os.path.dirname(__file__) | |
class MainHandler(tornado.web.RequestHandler): | |
def get(self): | |
#self.render(HERE+'fileuploadform.html') | |
self.render('/Users/amjith/playground/python/tornado/async_api/fileuploadform.html') |
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
import sys | |
from newrelic.api.function_trace import FunctionTrace | |
from newrelic.api.object_wrapper import ObjectWrapper | |
from newrelic.api.transaction import current_transaction | |
from newrelic.api.pre_function import wrap_pre_function | |
def wrap_handle_exception(*args): | |
transaction = current_transaction() | |
if transaction: |