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
def send_email(): | |
content = "This is an automatic email to notify you a new release has been deployed for CDK\n\n" | |
content += "CHANGES:\n" | |
new_tag = local("git tag | sort -V | tail -1", capture=True) | |
prev_tag = local("git tag | sort -V | tail -2 | head -1", capture=True) | |
content += local('git log %s...%s --pretty=format:"%%h - %%an - %%s"' % (new_tag, prev_tag), capture=True) | |
msg = MIMEText(content) | |
msg['Subject'] = "Release %s version in %s" % (env.version, env.build) | |
msg['From'] = "CDK dev team" | |
msg['To'] = "ABC@tangentlabs.co.uk" |
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 random import choice, shuffle | |
from pygene.gene import BaseGene | |
from pygene.organism import Organism, MendelOrganism | |
from pygene.population import Population | |
def flat_to_square(list_, size=9): | |
return [list_[i:i+size] for i in range(len(list_)/size)] |
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
# Full explaination here: http://anthony-tresontani.github.com/Django/2012/09/20/multilingual-search/ | |
""" | |
Provide an easy way to get solr multilingual search with Haystack. | |
To use it, define an haystack connexion string by language. | |
HAYSTACK_CONNECTIONS = { | |
'default_en':{ | |
'ENGINE': 'wdm.core.search.backend.MultilingualSolrEngine', | |
'URL': 'http://127.0.0.1:8080/solr-en', | |
}, |
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
def timeout_interrupt(timeout): | |
def timeout_handler(signum, frame): | |
raise TimeoutException() | |
def wrap(fn): | |
@wraps(fn) | |
def wrapped(*args, **kwargs): | |
old_handler = signal.signal(signal.SIGALRM, timeout_handler) | |
signal.alarm(timeout) | |
try: |