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 confirm(): | |
""" | |
Ask user to enter Y or N (case-insensitive). | |
:return: True if the answer is Y. | |
:rtype: bool | |
""" | |
answer = "" | |
while answer not in ["y", "n"]: | |
answer = raw_input("OK to push to continue [Y/N]? ").lower() |
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 argparse | |
import re | |
class Validator(object): | |
def __init__(self, pattern): | |
self._pattern = re.compile(pattern) | |
def __call__(self, value): |
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
<VirtualHost *:80> | |
ServerName HOSTNAME.DOMAIN | |
WSGIDaemonProcess threads=5 | |
WSGIScriptAlias / /PATH/TO/WSGI/DEFINITION/webapp.wsgi | |
<Directory /PATH/TO/WSGI/DEFINITION> | |
Order deny,allow | |
Require all granted | |
</Directory> |
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 random | |
my_randoms = random.sample(xrange(100), 13) | |
def merge(first_half, second_half): | |
if len(first_half) == 0: | |
return second_half | |
elif len(second_half) == 0: | |
return first_half |
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
fibonacci : function(n) { | |
// f(0) = 0 | |
// f(1) = 1 | |
// f(n) = f(n-1) + f(n-2) | |
if (n === 0) { | |
return 0; | |
} | |
if (n === 1) { | |
return 1; | |
} |
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
""" | |
requests | |
beautifulsoup4 | |
""" | |
import requests | |
from bs4 import BeautifulSoup | |
def to_rgb(hex): |
NewerOlder