-
First cd to the directory where all of your sites are located
$ cd /srv/sites -
Change all previous urls from
url = git@old-server.example.com:foo.gittourl = git@cod.example.com:foo.git$ cwd=`pwd`; for d in *; do if [[ -e "$cwd/$d/.git/config" ]]; then echo "$cwd/$d/.git/config" | xargs perl -i.bak -wpe 's|(url = git\@old-server(\.example\.com)?):([-_a-z]+)\.git|url = git\@new-server.example.com:$3.git|g'; fi; done
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 python | |
| from argparse import ArgumentParser | |
| import smtplib | |
| from email.mime.text import MIMEText | |
| """ | |
| Example Usage: | |
| ./send_email.py \ |
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 python | |
| from checkpid import pidcheck | |
| from time import sleep | |
| import logging | |
| log = logging.getLogger("checkpid") | |
| log.setLevel(logging.INFO) | |
| log.setLevel(logging.DEBUG) | |
| ch = logging.StreamHandler() |
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 python | |
| import tempfile | |
| import shutil | |
| """ | |
| Here is a test I created to recreate a problem I was having when I used | |
| tempfile.NamedTemporaryFile(). The problem is that when I use tempfile my | |
| data in my CSV is truncated off the end of the file. |
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
| # I downloaded the following: | |
| - http://www.nginx.org/download/nginx-1.0.12.tar.gz | |
| - https://github.com/agentzh/headers-more-nginx-module/tarball/v0.17rc1 | |
| sudo ./configure \ | |
| --prefix=/etc/nginx \ | |
| --conf-path=/etc/nginx/nginx.conf \ | |
| --error-log-path=/var/log/nginx/error.log \ | |
| --http-client-body-temp-path=/var/lib/nginx/body \ |
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
| ps ax -o rss,cmd --sort -rss | grep gunicorn | awk '{ SUM += $1} END { printf "%.2f MB\n", SUM/1000 }' |
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
| CELERY=`ps -A -o pid,rss,command | grep celeryd | grep -v grep | awk '{total+=$2}END{printf("%d", total/1024)}'` | |
| GUNICORN=`ps -A -o pid,rss,command | grep gunicorn | grep -v grep | awk '{total+=$2}END{printf("%d", total/1024)}'` | |
| REDIS=`ps -A -o pid,rss,command | grep redis | grep -v grep | awk '{total+=$2}END{printf("%d", total)}'` | |
| NGINX=`ps -A -o pid,rss,command | grep nginx | grep -v grep | awk '{total+=$2}END{printf("%d", total/1024)}'` | |
| OTHER=`ps -A -o pid,rss,command | grep -v nginx | grep -v celeryd | grep -v gunicorn | grep -v redis | grep -v grep | awk '{total+=$2}END{printf("%d", total/1024)}'` | |
| websites=`ps -A -o user,pid,rss,command | grep gunicorn | egrep -o "[a-z_]+\.py$" | sort | uniq | perl -wpe 's|\.py$||;' | xargs` | |
| printf "%-10s %3s MB\n" "Celery:" $CELERY | |
| printf "%-10s %3s MB\n" "Gunicorn:" $GUNICORN | |
| printf "%-10s %3s MB\n" "Nginx:" $NGINX | |
| printf "%-10s %3s KB\n" "Redis:" $REDIS |
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 python | |
| import requests | |
| import urllib2 | |
| def download_sill_to_disk(url, target_path): | |
| import shutil | |
| req = urllib2.urlopen(url) | |
| with open(target_path, 'wb') as fp: |
Ran the following so virtualenvwrapper worked again:
$ sudo curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | sudo python
$ sudo pip install virtualenvwrapperAfter I tried using django-admin.py runserver in a virtualenv I got the following error.
IOError: [Errno 2] No such file or directory: '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/__init__.py'Running the following fixed that error: