Utilities for loading configuration from a YAML file.
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 pymongo | |
| from datetime import datetime, timedelta, time | |
| from calendar import monthrange | |
| db = pymongo.MongoClient().test | |
| def generate_events(n, step): | |
| date = datetime.now() | |
| for i in range(n): |
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
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| # | |
| # Author: Roman Kalyakin | |
| # | |
| # EC2 to Route53 magic | |
| # | |
| # https://gist.github.com/4449827 | |
| # |
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
| -*- coding: utf-8 -*- | |
| from werkzeug.routing import BaseConverter | |
| from werkzeug.exceptions import BadRequest | |
| import bson | |
| class ObjectIdConverter(BaseConverter): | |
| '''Converts string to :class:`~bson.objectid.ObjectId` and | |
| vise versa:: |
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
| # 1. palindrome window the size of string | |
| # 2. split the window in half (omit central character is window size is odd) | |
| # 3. compare substrings | |
| # 4. if substings are equal - they are the longest palindrome | |
| # 5. else slide the window to the right and repeat | |
| # 6. if sliding the window right overflows the string, decrease the window and start again. | |
| def find_longest_palindrome(input): | |
| window_size = len(input) |
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
| 1. | |
| =============== | |
| xxx// Can you sehis? | |
| // Given as input: 3 + 4 + 6 * 7 * 2 + 8 ... | |
| // Assume just single digits, + and * | |
| // Evaluate it. | |
| // Walk through the following case: | |
| // 3 | |
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
| test: | |
| PYTHONPATH=. python test_dedot.py |
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
| # -*- coding: utf-8 -*- | |
| from .bananas import Bananas | |
| from .base import the_api | |
| the_api.add_url_rule('/bananas', view_func=Bananas.as_view('bananas')) | |
| the_api.add_url_rule('/farm/<farm_id>/bananas', view_func=Bananas.as_view('bananas_from_a_farm')) | |
| __all__ = [ |
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
| # Emperor uWSGI script | |
| description "uWSGI Emperor" | |
| start on runlevel [2345] | |
| stop on runlevel [06] | |
| exec uwsgi --master --die-on-term --emperor /etc/uwsgi --logto=/var/log/uwsgi/emperor.log |
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
| # convert MTS files to MOV for FCPX | |
| ffmbc -i inFile -vcodec copy -strict experimental outFile |