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 redis | |
import time | |
import twitter | |
twitter = twitter.Twitter() | |
R = redis.Redis() | |
while True: | |
for tweet in twitter.statuses.public_timeline(): |
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
from flask import Module, request, redirect, url_for, render_template, abort | |
from formalchemy import FieldSet | |
from example import db | |
from example import Service, User, Forum, Category, Topic, Post | |
mod = Module(__name__) | |
models = { |
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 redis | |
from django.conf import settings | |
from django.core.signals import request_finished | |
try: | |
from eventlet.corolocal import local | |
except ImportError: | |
from threading import local |
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
WORKDIR=$HOME/work/`basename $VIRTUAL_ENV` | |
cd () { | |
if (( $# == 0 )); then | |
if [ -d $WORKDIR ] && [ `pwd` != $WORKDIR ]; then | |
builtin cd $WORKDIR | |
else | |
builtin cd $VIRTUAL_ENV | |
fi | |
else |
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
# This all assumes you have the process running in | |
# a terminal screen and you're on Linux-like system. | |
# First off, suspend the process and background it | |
ctrl-z # suspend the process | |
bg # restart/continue the process in the background | |
# Now create files to log to. They can be called anything, | |
# Personally I would end the in .log. E.g. could be | |
# /var/logs/myprocess-stdout.log, |
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
#Dump | |
mysqldump db | gzip -c > db.sql.gz | |
pg_dump db | gzip -c > db.sql.gz | |
#use gzip --fast | |
#Restore | |
gunzip < db.sql.gz | mysql db | |
bunzip2 < db.sql.bz2 | mysql db |
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
#!/bin/sh | |
#alternative version using Preston Holmes' (ptone) fork of pip with support for | |
#special "cache" keyword to the --find-links option | |
#now pip can use the download cache and does not have to contact the index | |
mkenv(){ | |
virtualenv --no-site-packages $1; | |
source $1/bin/activate; | |
pip install git+https://github.com/ptone/pip.git@cache-as-findlinks#egg=pip-with-cache; | |
pip install --no-index --find-links=cache -r common.pip; |
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
""" | |
Patches the database wrapper and template engine to throw an exception if a query is executed inside of a template. | |
In your urls.py, enable it like so: | |
>>> import monkey | |
>>> monkey.patch_templates() | |
""" | |
import logging |
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
:+1: | |
:-1: | |
:airplane: | |
:art: | |
:bear: | |
:beer: | |
:bike: | |
:bomb: | |
:book: | |
:bulb: |
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
--http://stackoverflow.com/questions/193780/how-to-find-all-the-tables-in-mysql-with-specific-column-names-in-them | |
SELECT DISTINCT TABLE_NAME | |
FROM INFORMATION_SCHEMA.COLUMNS | |
WHERE COLUMN_NAME IN ('columnA','ColumnB') | |
AND TABLE_SCHEMA='YourDatabase'; |
OlderNewer