Skip to content

Instantly share code, notes, and snippets.

View stefanfoulis's full-sized avatar

Stefan Foulis stefanfoulis

View GitHub Profile
@stefanfoulis
stefanfoulis / search_indexes.py
Created May 4, 2010 08:08 — forked from beniwohli/search_indexes.py
fork with support for cms placeholders (upcoming cms 2.1 release)
from django.conf import settings
from django.utils.translation import string_concat, ugettext_lazy
from django.utils.html import strip_tags
from haystack import indexes, site
from cms.models.managers import PageManager
from cms.models.pagemodel import Page
from cms.models.pluginmodel import CMSPlugin
@stefanfoulis
stefanfoulis / gist:715194
Created November 25, 2010 10:39
django-filer: creating Folders and Files programmatically, If-Modified-Since aware download (quick and dirty)
def download_cover(url, name=None):
#print "========================== START"
#print "==== COVER URL: %s" % (url,)
purl = urlparse(url)
path = purl.path
if path.startswith('/'):
path = path[1:]
abspath = os.path.join(settings.MEDIA_ROOT,settings.RADIOPLAYLIST_COVERS_PREFIX,path)
relpath = os.path.join(settings.RADIOPLAYLIST_COVERS_PREFIX,path)
if not os.path.exists(os.path.dirname(abspath)):
@stefanfoulis
stefanfoulis / osx_developer_installation.rst
Last active December 23, 2019 02:32
Instructions on how to setup an OSX developer machine for (python/django) development

OSX Developer System installation

This guide assumes a fresh install of Mac OSX 10.7 Lion.

Brew User

@stefanfoulis
stefanfoulis / findauthors.sh
Created April 8, 2011 12:37
How to sync svn to git
#!/usr/bin/env bash
# Run this script inside a SVN checkout of the project
authors=$(svn log -q | grep -e '^r' | awk 'BEGIN { FS = "|" } ; { print $2 }' | sort | uniq)
for author in ${authors}; do
echo "${author} = NAME <USER@DOMAIN>";
@stefanfoulis
stefanfoulis / gist:1011159
Created June 6, 2011 21:30
copy command that copies HFS-Resource forks and metadata
sudo ditto -rsrc /Users/username /Volumes/OtherDisk/Users/
@stefanfoulis
stefanfoulis / at_commit.cfg
Created June 10, 2011 15:37
using external git sources in buildout
[buildout]
...
parts =
...
django-filer-git
[django-filer-git]
recipe=zerokspot.recipe.git
repository=git://github.com/stefanfoulis/django-filer.git
rev=c10e7e0b618b7718ae518ec33ecc8d5de6b62eaa
@stefanfoulis
stefanfoulis / how_it_work.rst
Created July 19, 2011 07:06
An example nginx conf for mogilefs and gunicorn

Private media

Browser accesses URL of Application:

http://www.example.com/private_media/my_file.pdf

The Permissions are checked by the application backend. If Access is denied the application backend returns a 403 and thats the end of it.

@stefanfoulis
stefanfoulis / ubuntu.rst
Created July 19, 2011 08:46
package list for new servers

python stuff that needs to be installed globally

apt-packages:

build-essential
python-setuptools
python-pip
python-imaging
@stefanfoulis
stefanfoulis / readme.rst
Created July 22, 2011 16:19
example supervisord script for starting django and gunicorn

example configuration for supervisord