Skip to content

Instantly share code, notes, and snippets.

@jsleetw
jsleetw / fabfile.py
Created December 13, 2011 07:34 — forked from anonymous/gist:156623
fabric example
"""
This fabric file makes setting up and deploying a django application much
easier, but it does make a few assumptions. Namely that you're using Git,
Apache and mod_wsgi and your using Debian or Ubuntu. Also you should have
Django installed on your local machine and SSH installed on both the local
machine and any servers you want to deploy to.
_note that I've used the name project_name throughout this example. Replace
this with whatever your project is called._
@jsleetw
jsleetw / update
Created December 16, 2011 05:04 — forked from hSATAC/update
git update hook
#!/bin/sh
# place in {repo}/.git/hooks/update
# chmod +x update
name="$1"
old="$2"
new="$3"
user_name=$(git log -1 --pretty=format:%aN $new)
#branch=$(git rev-parse --symbolic --abbrev-ref $1)
branch=${name#refs/heads/}
@jsleetw
jsleetw / gist:3446852
Created August 24, 2012 06:51
ntpdate over http proxy
date -s "$(wget --no-cache -S -O /dev/null google.com 2>&1 | sed -n -e '/ *Date: */ {' -e s///p -e q -e '}')"
@jsleetw
jsleetw / gist:4129994
Created November 22, 2012 08:32
make nginx
./configure --prefix=/opt/nginx --with-debug --with-http_dav_module \
--with-http_addition_module --with-http_geoip_module --with-http_gzip_static_module \
--with-http_image_filter_module --with-http_realip_module --with-http_stub_status_module \
--with-http_ssl_module --with-http_sub_module --with-http_xslt_module \
--with-ipv6 --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl --with-mail \
--with-mail_ssl_module \
--add-module=/opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.11/ext/nginx
-------------------------------------------------------------------------------------
without passenger
@jsleetw
jsleetw / gist:4554462
Created January 17, 2013 08:06
python pep8 check pre-commit script
#!/usr/bin/env python
from __future__ import with_statement
import os
import re
import shutil
import subprocess
import sys
import tempfile
#start command, stores pid in a file in /tmp
sudo python manage.py run_gunicorn -p /tmp/gunicorn.pid -b 127.0.0.1:8000 --daemon
#save as ./start
#stop command
sudo kill `cat /tmp/gunicorn.pid` #note those aren't apostrophes, but the ~ key
#save as ./stop
#restart commad
sudo kill -HUP `cat /tmp/gunicorn.pid`
postactivate
+
cd ~/dev/$env_name
+
will be kool
@jsleetw
jsleetw / samba_setup.txt
Created February 26, 2013 06:42
samba setup - from ubuntu share to mac
sudo apt-get install samba
edit: /etc/samba/smb.conf
[mfs]
path = /home/someone
writable = yes
add user:
smbpasswd -a someone
@jsleetw
jsleetw / gist:5132828
Last active December 14, 2015 18:58
setup postgresql with django on ubuntu
sudo apt-get install postgresql postgresql-clinet libpq-dev
pip install psycopg2
su postgres
createdb [db]
psql
CREATE USER "" WITH PASSWORD ''; ( user use " password use ')
on settings.py
DATABASES = {
@jsleetw
jsleetw / django_crontab_tamplate.sh
Created April 3, 2013 06:37
Django use manage.py with command as crontab job tamplate
#!/bin/sh
DJANGO_SETTINGS_MODULE=mysettings
export DJANGO_SETTINGS_MODULE
PYTHONPATH=/path/to/python_libs:/path/to/my_django_apps
export PYTHONPATH
/path/to/python /path/to/my_django_script