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 sqlalchemy import Column, Integer, Enum | |
from sqlalchemy.dialects.postgresql import TEXT | |
from sqlalchemy import MetaData, create_engine | |
from sqlalchemy.orm import sessionmaker, scoped_session | |
from sqlalchemy.ext.declarative import declarative_base | |
info = 'postgresql+psycopg2://panel_app@localhost:5432/panel_db' |
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 bash | |
# save this file to $repo_dir/.git/hooks/post-checkout | |
# make it executable and symlink it to $repo_dir/.git/hooks/post-merge | |
# Delete .pyc files and empty directories from root of project | |
cd ./$(git rev-parse --show-cdup) | |
find . -type f -name "*.pyc" \ | |
! -path "./git/*" \ |
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
class EmailAddress(UserDefinedType): | |
"""Represent the custom email_address DOMAIN.""" | |
def get_col_spec(self): | |
return 'email_address' | |
@property | |
def python_type(self): | |
return basestring |
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
""" | |
Obfuscate any email addresses by replacing their domain name | |
with something generated. | |
:author Skyler Slade | |
""" | |
import re | |
import string | |
import sys |
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
old_code = db.execute( | |
'''SELECT coupon_code, coupon_offer | |
FROM surveys | |
WHERE survey_id = %s''', survey_id).first() | |
if old_code: | |
logging.info("Returning old coupon_code %s for survey_id %d and panelist_id %d", | |
old_code, survey_id, panelist_id) | |
return dict(coupon_code=old_code['coupon_code'], | |
coupon_offer=old_code['coupon_offer'], | |
) |
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
office.announce.out-sick | |
office.announce.benefits | |
office.announce.fridge-cleaning | |
office.announce.general | |
developers.tech-news | |
developers.programming | |
rec.events.orlando | |
industry-news | |
in-the-news | |
product |
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
"tickets.py" 20L, 502C written | |
from pprint import pprint | |
num_servers = 3 | |
ids = [] | |
gen_how_many = 10000 | |
i = 0 | |
while i < num_servers: |
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
#!/bin/bash | |
S3_ACCESS_KEY=XXX | |
FILENAME=$(date +"coefficient_%Y_%m_%d.pg") | |
PATH=/home/skyler/ | |
echo "dumping database..." | |
/usr/bin/pg_dump coefficient --file $PATH$FILENAME | |
echo "uploading backup to S3..." |
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
#!/bin/bash | |
VENV=$1 | |
if [ -z $VENV ]; then | |
echo "usage: runinenv [virtualenv_path] CMDS" | |
exit 1 | |
fi | |
. ${VENV}/bin/activate | |
shift 1 | |
echo "Executing $@ in ${VENV}" | |
exec "$@" |
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
{ | |
"AK": "Alaska", | |
"AL": "Alabama", | |
"AS": "American Samoa", | |
"AZ": "Arizona", | |
"AR": "Arkansas", | |
"CA": "California", | |
"CO": "Colorado", | |
"CT": "Connecticut", | |
"DE": "Delaware", |