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 | |
import subprocess | |
import sys | |
import os.path | |
"""Script that runs pip-compile, but keeps comments. | |
Provide the same arguments as you would pip-compile, ensure that the filename is last. | |
The logic here is very simple and we don't care about edge cases, so it may break easily. |
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
/* | |
A few functions for encoding a selection as a short, USL-friendly string. | |
This can be used with history.js to update the URL based on the current selection and eventually decode it and display the relevant selection. | |
NB MS won't like "const" | |
*/ | |
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 decimal import Decimal | |
print(-5 % 360) # 355 | |
print(-5.0 % 360) # 355.0 | |
print(Decimal(-5) % 360) # -5 |
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 -r 8ce6f774762a epio/commands/upload.py | |
--- a/epio/commands/upload.py Tue Aug 09 20:57:55 2011 +0100 | |
+++ b/epio/commands/upload.py Wed Aug 10 00:46:04 2011 +0200 | |
@@ -18,19 +18,13 @@ | |
repo_dir = tempfile.mkdtemp(prefix="epio-upload-") | |
try: | |
# Copy the files across | |
+ additional_excludes = ['.git', '.gitignore', '.svn', '.epio-git', '.hg'] | |
+ base_command = ["rsync", "-a", "--exclude-from=.epioignore", ".", repo_dir] | |
subprocess.Popen( |
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 os | |
import errno | |
import time | |
import shutil | |
from threading import Timer | |
from contextlib import contextmanager | |
@contextmanager | |
def makedirs_with_easy_race(pth, wait=0.5): | |
""" Context manager for testing code that might suffer from a |
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
After 167 of 167 riders: | |
Andy Schleck's predicted time is 60:05 (based on 2010 TDF ride for yellow, mean - 0.5 std.dev) | |
Cadel's predicted time is 58:22 (based on 2008 TDF ride for yellow, mean - 1.3 std.dev) | |
Cadel would be faster by 1:43 |
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 decimal | |
a = decimal.Decimal(0) | |
isinstance(a, decimal.Decimal) # True | |
reload(decimal) | |
isinstance(a, decimal.Decimal) # False | |
decimal.Decimal(a) # Exception!? |
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 | |
""" | |
Run Django Tests with full test coverage | |
This starts coverage early enough to get all of the model loading & | |
other startup code. It also allows you to change the output location | |
from $PROJECT_ROOT/coverage by setting the $TEST_COVERAGE_OUTPUT_DIR | |
environmental variable. |