Skip to content

Instantly share code, notes, and snippets.

Gavin Carothers gcarothers

Block or report user

Report or block gcarothers

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gcarothers
gcarothers / requirements.txt
Created Nov 8, 2017
Requirements file that causes recursion depth exceeded
View requirements.txt
alabaster==0.7.10
alembic==0.8.8
amqp==1.4.9
amqplib==1.0.2
anyjson==0.3.3
apache-libcloud==0.17.0
appenlight-client==0.6.14
argh==0.26.1
astroid==1.2.1
avro==1.7.7
View gist:7a0a37ed51eeafbb9f5a
<label @json>
# Add a hostname to every record we generate.
<filter **>
type record_transformer
<record>
hostname "#{Socket.gethostname}"
application ${tag_parts[-1]}
</record>
</filter>
View example_session_code.py
def forbid_user_messages(request, user):
"""Provide messaging to users who have an active session and become
disabled for some reason."""
if user.inactive and not request.is_xhr:
# Log out inactive users.
headers = forget(request)
if user.trial_expiration:
error_msg = """Your Lex Machina trial has expired.
Please <a href="mailto:sales@lexmachina.com">contact sales</a>
to subscribe."""
View gist:464d82d1c88ba58f666f
pip install --upgrade 'pip>=1.4.1'
Requirement already up-to-date: pip>=1.4.1 in /home/lex/lib/python2.7/site-packages
pip install --upgrade 'setuptools>=0.8'
Requirement already up-to-date: setuptools>=0.8 in /home/lex/lib/python2.7/site-packages
pip install wheel
Requirement already satisfied (use --upgrade to upgrade): wheel in /home/lex/lib/python2.7/site-packages
pip wheel -w wheelhouse -f wheelhouse -r requirements.txt
ERROR: 'pip wheel' requires setuptools >= 0.8 for dist-info support. To fix this, run: pip install --upgrade setuptools
View exception_view.py
@view_config(context=Exception)
def exception_view(context, request):
# Check to see if debug toolbar is enabled.
from pyramid.interfaces import ITweens
tweens = request.registry.queryUtility(ITweens)
if tweens:
tween_list = tweens.explicit or tweens.implicit()
tween_names = zip(*tween_list)[0]
if tween_list and 'pyramid_debugtoolbar.toolbar_tween_factory' in\
tween_names:
View gist:95981a3d99dbcbcb75d4
home / sameroute.views.my_view *
home_again / <unknown> *
View sameroute.py
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response
def hello_world(request):
return Response('Hello %(name)s!' % request.matchdict)
if __name__ == '__main__':
config = Configurator()
config.add_route('hello', '/hello/{name}')
View sql_from_env.py
def engine_from_environ(prefix, settings, application_name=None):
"""Setup an SQLAlchemy engine with overrides from environment.
Maps KEYS_LIKE_THIS to keys.like.this"""
env_prefix = prefix.replace('.', '_').upper()
for env in os.environ:
if env.startswith(env_prefix):
key = env.replace('_', '.').lower()
settings[key] = os.environ[env]
if application_name is not None:
View pycon-plan.md

2015-04-10

  • Pyramid Booth
  • What can programmers learn from pilots?
  • Hyperactive: HTTP/2 and Python
  • Lunch
  • Pyramid Booth
  • My Python's a little Rust-y
  • Stop Sucking Me Into Your Drama: A Personal Appeal For Loose Coupling
  • Break
  • Fire your supervisord: running Python apps on CoreOS
View keybase.md

Keybase proof

I hereby claim:

  • I am gcarothers on github.
  • I am gavincarothers (https://keybase.io/gavincarothers) on keybase.
  • I have a public key whose fingerprint is 4EF1 6144 8024 2855 C8E4 F4F8 BFD9 CBF6 4483 588E

To claim this, I am signing this object:

You can’t perform that action at this time.