Great:
- Abundance of screenshots
- Very step-by-step & granular
- Love the description of the Terminal & the clear delineation of command-line bits
- The Homebrew output is excellently searchable (not just in screenies)
# For Django, at the bottom of ``settings.py`` after all your other settings... | |
# Setup a BoundLogger for the project/apps to use... | |
import structlog | |
structlog.BoundLogger.configure( | |
context_class=structlog.ThreadLocalDict(dict), | |
) |
""" | |
WSGI config for whatever. | |
This module contains the WSGI application used by Django's development server | |
and any production WSGI deployments. It should expose a module-level variable | |
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover | |
this application via the ``WSGI_APPLICATION`` setting. | |
Usually you will have the standard Django WSGI application here, but it also | |
might make sense to replace the whole Django WSGI application with a custom one |
""" | |
deltablue.py | |
============ | |
Ported for the PyPy project. | |
This implementation of the DeltaBlue benchmark was directly ported | |
from the `V8's source code`_, which was in turn derived | |
from the Smalltalk implementation by John Maloney and Mario | |
Wolczko. The original Javascript implementation was licensed under the GPL. |
import time | |
from boto3.core.session import Session | |
from boto3.sqs.resources import SQSQueue | |
session = Session() | |
SQSConnection = session.get_service('sqs') | |
conn = SQSConnection(region_name='us-west-2') | |
queue = SQSQueue(session=session, connection=conn) | |
queue.name = 'my_test_queue' |
# Use the following to generate the necessary values. | |
# https://web-identity-federation-playground.s3.amazonaws.com/index.html | |
from boto.sts.connection import STSConnection | |
sts = STSConnection(anon=True) | |
# Substitute your own values from the Playground here. | |
arn = 'arn:aws:iam::XXXXXXX:role/WebIdFed_Amazon' | |
session_name = 'web-identity-federation' | |
token = 'Atza|XXXXXXX' |
class Trackable(object): | |
def __init__(self, *args, **kwargs): | |
self._calls = [] | |
self._parent = None | |
def __getattr__(self, name): | |
self._calls.append({ | |
'method': '__getattribute__', | |
'args': [name], | |
'kwargs': {}, |
import time | |
import sound | |
from scene import * | |
class TeaTimer(Scene): | |
def setup(self): | |
self.initial_time = int(60 * 1.5) | |
self.remaining_time = self.initial_time | |
self.center_x = self.size.w * 0.5 |
from tastypie.resources import ModelResource | |
from whatever.models import Exercise, Set, AssignedExercise | |
class SetResource(ModelResource): | |
class Meta: | |
queryset = Set.objects.all() | |
def obj_create(self, bundle, **kwargs): | |
# First, rip out the exercise ids so as not to cause a field-list |