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
#!/usr/bin/env python | |
from fabric.api import local | |
def hello(name='world'): | |
print('\n\n') | |
print('Hello %s!' % name) | |
print('\n\n') |
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
#!/usr/bin/env python | |
""" | |
My solution to the BitTorrent Developer Challenge -- takes forever to run. | |
You have 40 bowls, all placed in a line at exact intervals of 1 meter. You | |
also have 9 oranges. You wish to place all the oranges in the bowls, no | |
more than one orange in each bowl, so that there are no three oranges A, B, | |
and C such that the distance between A and B is equal to the distance | |
between B and C. How many ways can you arrange the oranges in the bowls?. |
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 category(request, model, tag): | |
""" | |
Given a lowercase model name and tag, search for all models linked to | |
the given tag. The model is obtained by looking through a dictionary of | |
available models. | |
""" | |
available_models = {'apps': App, 'data': Data, 'ideas': Idea} | |
try: | |
actual_model = available_models[model] | |
except KeyError: |
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
#!/usr/bin/env python | |
"""Looking up environment variables through `vars`.""" | |
def ohai(): | |
"""A simple function.""" | |
print 'ohai' | |
class Foo(object): |
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
#!/usr/bin/env python | |
"""Looking up environment variables through `vars`.""" | |
def ohai(): | |
"""A simple function.""" | |
print 'ohai' | |
class Foo(object): |
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
"""Just showing off timeit to tell the difference between operations.""" | |
from timeit import Timer | |
# We'll run each one a thousand times. | |
print Timer("[0] * 7000").timeit(1000) | |
print Timer("bytearray(7000)").timeit(1000) | |
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
#!/usr/bin/env python | |
"""For ctbarna.""" | |
list_of_dicts = [ | |
{'key_1': 'value_1', 'key_2': 'value_2'}, | |
{'key_1': {'inception_key': 'inception_value'}, 'key_2': 'value_2'}, | |
{'key_1': 'value_1', 'key_2': 'value_2'}, | |
] |
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
#!/usr/bin/env python | |
"""For ctbarna.""" | |
list_of_dicts = [ | |
{'key_1': 'value_1', 'key_2': 'value_2'}, | |
{'key_1': {'inception_key': 'inception_value'}, 'key_2': 'value_2'}, | |
{'key_1': 'value_1', 'key_2': 'value_2'}, | |
] |
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
// An example of mixing colors using the Less CSS parser. | |
// This specific example warms the color #222 with a yellow. | |
var parser = new(less.Parser); | |
function print_tree(event, tree) { | |
console.log(tree.toCSS()); | |
} | |
parser.parse('@dark: #222; @yellow: #fcd20a; .my{ color: mix(@yellow, @dark, 6%); }', print_tree); |
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
Last login: Wed Sep 28 01:53:45 on ttys010 | |
zachwill:~ ✩ DYLD_LIBRARY_PATH="/Users/zachwill/Downloads/GP.app/Contents/Resources/PARI2/lib:$DYLD_LIBRARY_PATH"; '/Users/zachwill/Downloads/GP.app/Contents/Resources/PARI2/bin/gp' | |
dyld: Library not loaded: /Users/chris/Downloads/pari-2.5.0/~/PARI/lib/libpari.dylib | |
Referenced from: /Users/zachwill/Downloads/GP.app/Contents/Resources/PARI2/bin/gp | |
Reason: image not found | |
Trace/BPT trap: 5 | |
zachwill:~ ✩ |
OlderNewer