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
re.compile('^(http|https|git)://(www|)github.com/' | |
'(?P<organization>([^/]+))/' | |
'(?P<repository>((?!(\.git|/)).)+)' | |
'(.git)?/?$') |
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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css"> | |
<script src="http://cmx.io/v/0.1/cmx.js" charset="utf-8"></script> | |
<style>.cmx-user-scene4 .cmx-text-border .cmx-path {stroke: orange}</style> | |
<body> | |
<div style="max-width:900px; -webkit-transform:rotate(0deg)"> | |
<scene id="scene1"> | |
<actor t="translate(71,19) rotate(-2)" pose="-11,9|-5,117|-11,99|-11,89|-11,79|-11,59|-16,34|-21,9|-6,34|-1,9|-18,79|-18,59|-6,79|-1,59"> |
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
$ git checkout --detach HEAD | |
... | |
$ git branch | |
* (detached from HEAD) | |
master | |
$ git branch -m master master-dirty | |
$ git branch | |
* (detached from HEAD) | |
master-dirty | |
$ git branch master origin/master |
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
$ tox | |
GLOB sdist-make: /Users/dhermes/google_contracting/gcloud-python/setup.py | |
py26 inst-nodeps: /Users/dhermes/google_contracting/gcloud-python/.tox/dist/gcloud-0.02.2.zip | |
py26 runtests: PYTHONHASHSEED='189486614' | |
py26 runtests: commands[0] | nosetests | |
............ | |
---------------------------------------------------------------------- | |
Ran 12 tests in 1.541s | |
OK |
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
import __builtin__ | |
import ast | |
import collections | |
import shutil | |
import sys | |
import tempfile | |
TRIPLE_QUOTES = ('"""', '\'\'\'') | |
# Also see: http://stackoverflow.com/a/17478618/1068170 |
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
>>> import itertools | |
>>> for pair in itertools.product((0, 1), repeat=2): | |
... print pair | |
... | |
(0, 0) | |
(0, 1) | |
(1, 0) | |
(1, 1) |
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
>>> len(list(itertools.product((0, 1), repeat=5))) | |
32 |
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 fits_criterion(digit_list): | |
for i in xrange(10): | |
if digit_list.count(i) != digit_list[i]: | |
return False | |
return True |
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
for first5 in xrange(10**4, 10**5): | |
first5_list = map(int, str(first5)) | |
for last5 in itertools.product((0, 1), repeat=5): | |
digit_list = first5_list + list(last5) # last5 is a tuple | |
if fits_criterion(digit_list): | |
print digit_list |
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
[6, 2, 1, 0, 0, 0, 1, 0, 0, 0] |
OlderNewer