Skip to content

Instantly share code, notes, and snippets.

@jaymzcd
jaymzcd / git_tips.md
Created September 22, 2011 09:42
Few git things for pushing remotes/setting up on centos/rhel

Git things internally

Installation of Git on RHEL/CentOS

first, and you probably wont really ever need this unless you're doing a bare bones install of a cent/rhel box, the webtactic repo maintains a decently up to date git install that will cleaning go onto such a box:

sudo rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm
sudo yum install --enablerepo=webtatic git-all

Now you have working git!

@tomviner
tomviner / spottylotty.py
Created September 9, 2011 15:43
Spotify Ticket Lottery
from __future__ import division
import sys
import math
import random
# http://www.spotify.com/us/jobs/tech/ticket-lottery/
def bc(n, k, f=math.factorial):
"""Binomial coefficient in terms of Factorials
(n) = ____n!____
@jaymzcd
jaymzcd / assign_file.py
Created July 13, 2011 11:23
Assign slugs and images based on a models fields - commands to use with a django shell
def assign_file_to_model(module, model_class=None, file_field='main_image', source_field='body', skip_existing=True, verbose=False):
""" We tend to have "main image" fields on models that hold a primary image used
across the sites for things like list pages and headers. Often on import of
existing data we have images mangled within copy or lists. """
import urllib2
from posixpath import basename
from BeautifulSoup import BeautifulSoup as Soup
from django.db import IntegrityError
======================================================
Setting up Django using Apache/mod_wsgi on Ubuntu 8.10
======================================================
This article will cover setting up Django using Apache/mod_wsgi on Ubuntu
8.10. The article is targeted at a production environment, but keep in mind
this is a more generalized environment. You may have different requirements,
but this article should at least provide the stepping stones.
The article will use distribution packages where nesscary. As of 8.10 the