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
""" | |
Copies a parameter group in RDS, particularly useful for doing cross-region copies (which AWS documents, | |
but doesn't actually support at the time of this writing. | |
Usage: python cp-parameter-group.py us-west-1:lookerdb-56 us-west-2:lookerdb-56 | |
""" | |
import boto3 | |
import sys |
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
""" | |
This is the basis for an elasticsearch 1.x backend I've cobbled together and am continuing | |
to refine and test for use. It's based on haystack master's version as of: | |
- https://github.com/toastdriven/django-haystack/blob/cbb72b3253404ba21e20860f620774f7b7b691d0/haystack/backends/elasticsearch_backend.py | |
But with @HonzaKral and @davedash's work to make the backend behave more like an ES user would expect with regard to doc types: | |
- https://github.com/toastdriven/django-haystack/pull/921 | |
I also made a number of changes: | |
- I fixed bugs that I found in #921 (mostly related to mapping synchronization issues), | |
all of which I wrote up as comments on #921 |
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
['Fizz' * (not bool(i % 3)) + 'Buzz' * (not bool(i % 5)) for i in xrange(1,101) if i % 3 == 0 or i % 5==0] |
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
>>> class my_dec(object): | |
... def __init__(self, f): | |
... self.f = f | |
... | |
>>> class my_dec(object): | |
... def __init__(self, f): | |
... self.f = f | |
... def __call__(self, *args): | |
... return self.f(*args) | |
... |
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
retVal = datetime.strptime( dateTimeStr, "%Y%m%d" ) | |
ImportError: Failed to import _strptime because the import lockis held by another thread. |
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 dictshield.document import Document | |
from dictshield.fields import StringField, IntField | |
from django.db import models | |
def _build_client_model(model): | |
""" | |
Take a Django model, and return a DictShield Document subclass | |
which is very representative. | |
TODO: |
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 | |
valid_words = set([ | |
'AA', 'AB', 'AD', 'AE', 'AG', 'AH', 'AI', 'AL', 'AM', 'AN', 'AR', 'AS', 'AT', 'AW', 'AX', 'AY', | |
'BA', 'BE', 'BI', 'BO', 'BY', | |
'DE', 'DO', | |
'ED', 'EF', 'EH', 'EL', 'EM', 'EN', 'ER', 'ES', 'ET', 'EX', | |
'FA', 'FE', | |
'GO', | |
'HA', 'HE', 'HI', 'HM', 'HO', |
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 logging | |
from celery.signals import task_postrun | |
from celery.task import task | |
from haystack import site | |
def bounce_worker_after(func): | |
""" | |
A decorator which will ensure that the celery worker is shutdown (and subsequently restarted by celery) | |
after this task is executed. |
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
class Choices(object): | |
def __getattr__(self, item): | |
if str(item).isdigit(): | |
try: | |
return self.__getitem__(item) | |
except KeyError: | |
pass | |
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
# For local dev purposes, allow for importing of add'l settings from | |
# a settings_local.py file (over-rides any already set above) | |
if DEBUG: | |
try: | |
from settings_local import * | |
except ImportError: | |
pass | |
else: | |
# Special treatment for symbols in settings_local that begin with 'EXTRA_'. |
NewerOlder