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 warnings | |
| def fxn(): | |
| warnings.warn("deprecated", DeprecationWarning) | |
| with warnings.catch_warnings(): | |
| warnings.filterwarnings('ignore', category=DeprecationWarning) | |
| fxn() |
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
| def trace(fun): | |
| def decorated(*args, **kwargs): | |
| import traceback | |
| print '-' * 20 | |
| print repr(fun), "\n" | |
| print "args=", repr(args), "kwargs=", repr(kwargs) | |
| traceback.print_stack() | |
| print '-' * 20 | |
| return fun(*args, **kwargs) | |
| return decorated |
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
| grep -v "==" requirements.txt | grep -v "^#" | awk 'NF > 0' | sort |
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
| def choose_from(choices, prompt="Which do you choose?"): | |
| while True: | |
| for index, choice in enumerate(choices): | |
| print "%2d. %s" % (index, choice) | |
| choice = raw_input("\n%s " % prompt) | |
| try: | |
| choice = int(choice) | |
| if choice < 0: | |
| raise ValueError | |
| return choices[choice] |
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
| def shell_lines(s): | |
| return " ".join([ l.strip() for l in s.splitlines() ]) | |
| def local_env(**additional): | |
| return dict(*env.values(), *additional.values()) |
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
| Host ec2*.compute.amazonaws.com | |
| User ubuntu |
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
| while aws cloudformation describe-stacks | grep CREATE_IN_PROGRESS >/dev/null; | |
| do | |
| sleep 1; | |
| done | |
| terminal-notifier -message "Environment Ready" |
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
| def lowerdictkeys(d): | |
| new = {} | |
| for k, v in d.iteritems(): | |
| if type(v) == type({}): | |
| v = lowerdictkeys(v) | |
| k = k.lower() | |
| new[k] = v | |
| return new | |
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 .settings import * | |
| LOGGING['formatters']['logsna'] = {'()': 'logsna.Formatter'} | |
| db_handler = {'level': 'INFO', | |
| 'class': 'logging.handlers.RotatingFileHandler', | |
| 'filename': here('logs', 'db.log'), | |
| 'maxBytes': 4194304, | |
| 'formatter': 'logsna', |
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
| Ups.GridLayout = SC.View.extend({ | |
| init: function() { | |
| sc_super(); | |
| var childViews = this.get('childViews'), idx, height, width, x, y, top, left, view, heightpct, widthpct; | |
| // calculate height / width percentages | |
| height = this.get('gridlayout').height; | |
| heightpct = 1 / height; | |
| width = this.get('gridlayout').width; | |
| widthpct = 1 / width; |