Skip to content

Instantly share code, notes, and snippets.

View epicserve's full-sized avatar

Brent O'Connor epicserve

View GitHub Profile
@epicserve
epicserve / postgres-notes.mdown
Created October 9, 2010 22:04
Postgres Notes

Postgres Notes

Controlling Postgres

Start Postgres

$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start

Stop Postgres

@epicserve
epicserve / django-debugging-packages.md
Created December 7, 2010 06:51
Django Debugging Packages

Django Debugging Packages

docutils
ipython
ipdb
django-debug-toolbar

@epicserve
epicserve / gist:1105465
Created July 25, 2011 22:50
Django-ses Return-Path/Source Patch
From 312aada9b74320de3599b6f19e6350e3538cde72 Mon Sep 17 00:00:00 2001
From: Brent O'Connor <epicserve@gmail.com>
Date: Mon, 25 Jul 2011 15:32:24 -0700
Subject: [PATCH] Added a way to change the source so that bounce messages are
sent to the return_path of the message if the return_path
is set.
---
django_ses/__init__.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
@epicserve
epicserve / sublime_text_2_notes.md
Created July 27, 2011 15:40
Notes on My Sublime Text 2 Setup

User File Settings

{
    "draw_indent_guides": false,
    "fold_buttons": true,
    "font_face": "Meslo LG S",
    "font_size": 13,
    "highlight_line": true,
    "ignored_packages": [],

"open_files_in_new_window": false,

@epicserve
epicserve / djanog-celery-and-redis-on-osx-lion.md
Created July 28, 2011 15:37
Django-celery + Redis notes

Django-celery + Redis notes

Installation and Setup

  1. Install redis on OSX (10.7) Lion I used:

     $ brew install redis
    
  2. In the project and virtualenv I wanted to use django-celery in I installed the following.

@epicserve
epicserve / save_cookie_example.py
Created August 3, 2011 17:04
Example of how to save a cookie for logging into a website.

I have a script that I've written that creates about 19,000 tasks. Each task grabs the content from a unique URL using python's urllib2 and then parses page HTML it using BeautifulSoup. I've tested the script on my MacBookPro, which runs fine. Now I'm trying to get the script to run on a production server which is running OSX 10.5.8 server. On the production server when I run, django-admin.py celeryd --loglevel=INFO -n example.com I can watch it process the tasks, however it will process tasks for about 10 seconds and then stop for about 5 minutes and then process tasks again for 10 seconds, pause for 5 minutes, and repeat until it's processed all the tasks or I kill the celeryd process.

Here is the example output... First it processes tasks for ~10 seconds:

[2011-09-01 10:08:16,750: INFO/MainProcess] Got task from broker: example.tasks.example_task[273d16fe-b123-4238-9166-63069d921a0d]
...
[2011-09-01 10:08:27,713: INFO/MainProcess] Task example.tasks.example_task[8db8e29c-7657-4c4f-aa8d-1
@epicserve
epicserve / svn_to_git.rst
Created September 15, 2011 17:17
Convert SVN Repositories to Git Repositories

Convert SVN Repositories to Git Repositories

This guide on how to convert an SVN repository to a git repository was mostly taken from John Albin Wilkins post on Converting a Subversion repository to Git.

1. Retrieve a list of all Subversion committers

:

@epicserve
epicserve / base_aliases
Created October 12, 2011 17:14
My base aliases file
#!/usr/bin/env bash
# Helpful Aliases
alias ex="exit"
alias e="subl"
alias c="clear"
alias ls="ls -lh"
alias la="ls -lah"
alias pwd="pwd -LP"
@epicserve
epicserve / fabfile.py
Created October 27, 2011 20:47
Django project fabfile template
from fabric.api import cd, run, env, local
from fabric.colors import green
from django.conf import settings
env.hosts = ['foo.example.com']
env.code_dir = '/var/www/project'
env.virtualenv = '/usr/local/virtualenvs/project'
env.django_project_root = settings.DJANGO_PROJECT_ROOT
env.django_settings_module = 'config.settings'