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 __future__ import absolute_import | |
| import logging | |
| logger = logging.getLogger(__name__) | |
| import time | |
| import pytz | |
| from datetime import datetime, timedelta |
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
| diff -ru stock/dm.xmlsec.binding-1.3.2/setup.py mod/dm.xmlsec.binding-1.3.2/setup.py | |
| --- stock/dm.xmlsec.binding-1.3.2/setup.py 2015-01-10 03:18:26.000000000 -0500 | |
| +++ mod/dm.xmlsec.binding-1.3.2/setup.py 2015-07-10 15:43:41.000000000 -0400 | |
| @@ -95,19 +95,22 @@ | |
| if libxml2_libs[:2] not in ["-l", "-L"]: | |
| sys.exit("Error : cannot get LibXML2 linker flags; do you have the `libxml2` development package installed?") | |
| +XMLSEC_CONFIG=environ.get('XMLSEC_CONFIG', '') | |
| crypto_engine = environ.get("XMLSEC_CRYPTO_ENGINE") | |
| if crypto_engine is None: |
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
| Plucky-Badger-2:celeritypy jginsberg$ ipython | |
| Python 2.7.6 (default, Sep 9 2014, 15:04:36) | |
| Type "copyright", "credits" or "license" for more information. | |
| IPython 3.0.0 -- An enhanced Interactive Python. | |
| ? -> Introduction and overview of IPython's features. | |
| %quickref -> Quick reference. | |
| help -> Python's own help system. | |
| object? -> Details about 'object', use 'object??' for extra details. |
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
| # Excerpt from Dockerfile | |
| COPY . /www | |
| WORKDIR /www | |
| RUN curl -sS https://getcomposer.org/installer | /usr/bin/php -- --install-dir=/www --filename=composer | |
| RUN ./composer install | |
| RUN chown -R www-data:www-data /www | |
| EXPOSE 9000 | |
| CMD /usr/sbin/php5-fpm -F |
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
| In [1]: import pytz | |
| In [2]: from datetime import datetime, date, time, timedelta | |
| In [3]: now = datetime.utcnow().replace(tzinfo=pytz.UTC) | |
| In [4]: now | |
| Out[4]: datetime.datetime(2015, 4, 3, 18, 17, 45, 509236, tzinfo=<UTC>) | |
| In [5]: localnow = now.astimezone(pytz.timezone('US/Eastern')) |
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 g(): | |
| x = 1 | |
| def f(): | |
| return x * 2 | |
| return f | |
| f = g() | |
| # How can I, from only having a reference to f, access the value of x from the local context of the call to g() that created f? |
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
| [2015-01-23 12:19:08,775: ERROR/MainProcess] Unrecoverable error: TypeError('__init__() takes at least 2 arguments (1 given)', <class 'django.core.exceptions.ValidationError'>, ()) | |
| Traceback (most recent call last): | |
| File "/virtualenv/local/lib/python2.7/site-packages/celery/worker/__init__.py", line 206, in start | |
| self.blueprint.start(self) | |
| File "/virtualenv/local/lib/python2.7/site-packages/celery/bootsteps.py", line 123, in start | |
| step.start(parent) | |
| File "/virtualenv/local/lib/python2.7/site-packages/celery/bootsteps.py", line 374, in start | |
| return self.obj.start() | |
| File "/virtualenv/local/lib/python2.7/site-packages/celery/worker/consumer.py", line 278, in start | |
| blueprint.start(self) |
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
| [2015-01-23 11:05:18,977: ERROR/MainProcess] Unrecoverable error: TypeError('__init__() takes at least 2 arguments (1 given)', <class 'django.core.exceptions.ValidationError'>, ()) | |
| Traceback (most recent call last): | |
| File "/virtualenv/local/lib/python2.7/site-packages/celery/worker/__init__.py", line 404, in start | |
| component.start() | |
| File "/virtualenv/local/lib/python2.7/site-packages/celery/worker/consumer.py", line 410, in start | |
| self.consume_messages() | |
| File "/virtualenv/local/lib/python2.7/site-packages/celery/worker/consumer.py", line 495, in consume_messages | |
| readers[fileno](fileno, event) | |
| File "/virtualenv/local/lib/python2.7/site-packages/billiard/pool.py", line 664, in handle_event | |
| self._it.next() |
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 alphabet will convert an Instagram photo ID to the base 64 number used in the URLs | |
| // however, be wary of javascript's maxint value | |
| alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'; | |
| function b64encode(i) { | |
| if (i == 0) { | |
| return alphabet.charAt(0); | |
| } else { | |
| return b64encode(Math.floor(i / 64)) + alphabet.charAt(i % 64); | |
| } |
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
| # Django 1.4 only allowed this | |
| episodes = [ | |
| rel.episode for rel in series_obj.episode_relations.order_by('episode__title') | |
| if rel.episode.showtime_set.filter(start__lte=end_date) | |
| ] | |
| # Django 1.7 allows this | |
| episodes = Episode.objects.filter(episoderelation__series=series_obj, | |
| showtime__start__lte=end_date).order_by('title').distinct() |