Skip to content

Instantly share code, notes, and snippets.

View jeremyjbowers's full-sized avatar

Jeremy Bowers jeremyjbowers

View GitHub Profile
@jeremyjbowers
jeremyjbowers / thumbs.py
Created January 24, 2011 03:41
A forked/fixed thumbs.py to solve a problem with syntax
# -*- encoding: utf-8 -*-
"""
django-thumbs by Antonio Melé
http://django.es
"""
from django.db.models import ImageField
from django.db.models.fields.files import ImageFieldFile
from PIL import Image
from django.core.files.base import ContentFile
import cStringIO
user www-data;
worker_processes 1;
error_log /opt/log/nginx.log;
pid /opt/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
}
http {
user www-data;
worker_processes 1;
error_log /opt/log/nginx.log;
pid /opt/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
}
http {
@jeremyjbowers
jeremyjbowers / brotatoes.txt
Created October 10, 2011 11:58 — forked from ryanpitts/brotatoes.txt
Weekend potato recipe
Weekend potatoes (or Brotatoes, to annoy teenage sons)
Yep, when you break it down, these are pretty simple. But they taste
good like crack late on a Sunday morning.
-----------
INGREDIENTS
-----------
- a big-ass skillet (I use a 15-inch nonstick. Cast iron would be great.
@jeremyjbowers
jeremyjbowers / views.py
Created October 14, 2011 19:11
An example of class-based views in use at the Washington Post.
from django.views.generic import dates
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from django.contrib.syndication.views import Feed
from django.shortcuts import get_object_or_404
from django.db.models import Q, Count, Aggregate
from fallen.models import Casualty, Theater, Branch, HomeState, CauseOfDeath, IncidentProvince
from django.template.defaultfilters import upper
from haystack.views import SearchView
import datetime
@jeremyjbowers
jeremyjbowers / awesome.js
Created October 31, 2011 14:29 — forked from drinks/awesome.js
Better AutoAwesome
var loveit = function(){var e,el,interval=Math.random()*60000;e = new jQuery.Event("click");e.pageX=1;e.pageY=1;el = jQuery('.record_pile:last').nextAll('a').eq(2);turntable.lastMotionTime=new Date().getTime();el.hover().trigger(e);setTimeout(loveit, interval);};loveit();
@jeremyjbowers
jeremyjbowers / varnish-directors
Created December 31, 2011 02:37
A demonstration of Varnish directors
director backend random {
.retries = 5;
{
.backend = {
.host = "192.168.1.100";
.port = "8000";
}
.weight = 1;
}
{
@jeremyjbowers
jeremyjbowers / varnish-backend
Created December 31, 2011 03:07
A simple varnish backend.
backend default {
.host = "192.168.1.100";
.port = "8000";
}
@jeremyjbowers
jeremyjbowers / varnish-miss-path-simple
Created December 31, 2011 03:59
The "miss" portion of a request in Varnish
sub vcl_recv {
# Set the backend for the request if it should miss the cache.
set req.backend = backend;
# Send the request along to the cache lookup.
return(lookup);
}
@jeremyjbowers
jeremyjbowers / varnish-simple.vcl
Created December 31, 2011 04:59
A simple Varnish configuration file.
/*
*
* First, set up a backend to answer the request if there's not a cache hit.
*
*/
backend default {
# Set a host.
.host = "192.168.1.100";