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 libcloud.storage.types import Provider | |
from libcloud.storage.providers import get_driver | |
ACCESS_KEY_ID, SECRET_ACCESS_KEY = 'chinko', 'manko' | |
driver_class = get_driver(Provider.S3_AP_NORTHEAST) | |
driver = driver_class(ACCESS_KEY_ID, SECRET_ACCESS_KEY) | |
container = driver.get_container(container_name='my-bucket-name') | |
with open('tenga.txt', 'rb') as iterator: | |
driver.upload_object_via_stream(iterator=iterator, container=container, object_name='tenga') |
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
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
func main() { | |
fmt.Println("hello") |
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
""" | |
- /init to initialize service | |
- /update?uid=XXX to tell service XXX is active | |
- /count to get how many clients are active within last TIME_LIMIT sec. | |
""" | |
KEY = 'users' | |
TIME_LIMIT = 10 | |
MAX_RETRIES = 3 |
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
alias mksandbox='virtualenv --no-site-packages sandbox; source sandbox/bin/activate' | |
alias usesandbox='source sandbox/bin/activate' |
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 google.appengine.ext import db | |
class ReferenceProperty(db.ReferenceProperty): | |
"""A property that represents a many-to-one reference to another model. | |
This acts as identical to google.appengine.ext.db.ReferenceProperty, | |
except objects returns None when referenced entity does not exist | |
instead of raising ReferencePropertyResolveError. | |
""" | |
def __get__(self, *args, **kw): |
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 unittest | |
class TestCaseMeta(type): | |
"""Metaclass for TestCase class | |
This metaclass make setUp method calls all setUp methods in base classes | |
and then calls defined setUp method. Likewise tearDown but in opposite | |
order. | |
""" |
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 unittest | |
from nonvirtualunittest import TestCase | |
class BaseTestCase(TestCase): | |
def setUp(self): | |
self.foo = [1] | |
class MyTestCase(BaseTestCase): | |
def setUp(self): | |
self.foo.append(2) |
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
class CascadingTestCaseMeta(type): | |
"""Metaclass for TestCase class | |
This metaclass make setUp method calls all setUp methods in base classes | |
and then calls defined setUp method. Likewise tearDown but in opposite | |
order. | |
""" | |
def __init__(cls, name, bases, ns): | |
for method_name, reverse in [('setUp',False), ('tearDown', True)]: |
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
auto: | |
@while :; do make html_silent; sleep 1; done | |
html_silent: .built | |
@echo > /dev/null | |
.built: *.rst img/* | |
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html | |
@touch .built | |
@echo |
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
#!/bin/sh | |
hg log -b `hg branch` -v | awk '$1 !~ /(changeset|branch|user|date|files|description|tag):/ {print}' |
OlderNewer