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 subprocess | |
import fabric | |
def local(command, capture=False, shell=False, bg=False): | |
if bg: | |
if capture: | |
with open("/dev/null", "w") as f: | |
subprocess.Popen(command.split(), stdout=f, shell=shell) |
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
""" | |
Python scope is not dynamic. | |
""" | |
def foo(): | |
print x | |
x = 0 | |
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 sys | |
import time | |
from sh import networksetup | |
DEVICE = 'en0' | |
NETWORK = u'AirPennNet' | |
def connect_to_network(network): |
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
## | |
# sms_bomb | |
# ======== | |
# | |
# Send a bunch of texts (from multiple numbers) to a target number. | |
# | |
# Installation | |
# ------------ | |
# | |
# `gem install twilio-ruby` |
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
class Email(object): | |
message = 'Enter a valid email address.' | |
user_regex = re.compile( | |
r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*$" # dot-atom | |
r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016-\177])*"$)', # quoted-string | |
re.IGNORECASE) | |
domain_regex = re.compile( | |
r'(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?$)' # domain | |
# literal form, ipv4 address (SMTP 4.1.3) | |
r'|^\[(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}\]$', |
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
[email protected]:Ceasar/dot_zsh.git | |
[email protected]:Ceasar/dot_vim.git | |
[email protected]:Ceasar/dot_gitconfig.git | |
[email protected]:Ceasar/dotfiles.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
# Start postgres | |
alias pgstart='pg_ctl -l $PGDATA/server.log start' | |
# Stop postgres | |
alias pgstop='pg_ctl stop -m fast' | |
# Postgres stuff | |
export PGDATA='/usr/local/var/postgres' | |
# Register a python project on pypi |
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
# -*- coding: utf-8 -*- | |
""" | |
:copyright: (c) 2011 by Armin Ronacher. | |
:copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details. | |
:license: BSD, see LICENSE for more details. | |
""" | |
import os | |
import sys | |
import unittest |
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 timeit | |
setup = """ | |
def primes(n): | |
'''Get all primes up to n.''' | |
if n < 2: | |
return [] | |
nums = range(n) | |
sieve = set(xrange(2, 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
""" | |
""" | |
import inspect | |
import re | |
import pprint | |
FUNCTION_PATTERN = re.compile(".*\s((\.|\w)+)\(") | |