Skip to content

Instantly share code, notes, and snippets.

View pizzapanther's full-sized avatar
🍕
Crushing it daily

Paul Bailey pizzapanther

🍕
Crushing it daily
View GitHub Profile
@pizzapanther
pizzapanther / ceasy_requirements.txt
Created January 3, 2012 15:35
Django Celery Database Setup
Django==1.3.1
django-celery==2.3.3
django-kombu==0.9.4
@pizzapanther
pizzapanther / credis_requirements.txt
Created January 3, 2012 15:43
Django Celery Redis Setup
Django==1.3.1
django-celery==2.3.3
redis==2.4.9
celerymon
@pizzapanther
pizzapanther / roku_preset.xml
Created January 8, 2012 02:42
Handbrake Roku Preset
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>ChildrenArray</key>
<array>
<dict>
<key>AudioList</key>
<array>
@pizzapanther
pizzapanther / dump_settings.py
Created March 4, 2012 00:38
Dump Settings Django Management Command
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
class Command (BaseCommand):
#args = '<poll_id poll_id ...>'
#help = HELP
def handle(self, *args, **options):
for s in dir(settings):
print s, ':', getattr(settings, s)
@pizzapanther
pizzapanther / menu.lst.diff
Created June 15, 2012 20:47
Fix Ubuntu 12.04 menu.lst for Rackspace
Line 1: Good
Line 2: Bad
135c135
< kernel /boot/vmlinuz-3.2.0-25-virtual root=/dev/xvda1 console=hvc0 ro quiet splash
---
> kernel /boot/vmlinuz-3.2.0-25-virtual root=UUID=/dev/xvda1 ro quiet splash
140c140
< kernel /boot/vmlinuz-3.2.0-25-virtual root=/dev/xvda1 console=hvc0 ro single
---
@pizzapanther
pizzapanther / sorl_check.py
Created November 8, 2012 22:27
Check if Thumbnail is stored by Sorl
from sorl.thumbnail.images import ImageFile
from sorl.thumbnail import default
from sorl.thumbnail.conf import settings, defaults as default_settings
def cached_thumbnail (photo, geometry, **options):
source = ImageFile(photo)
for key, value in default.backend.default_options.iteritems():
options.setdefault(key, value)
@pizzapanther
pizzapanther / get_form.py
Created August 29, 2013 18:20
Admin get_form override
class EventAdmin(admin.ModelAdmin):
def get_form(self, request, obj=None, **kwargs):
if request.user.is_superuser:
return EventAdminForm
else:
return EventForm
@pizzapanther
pizzapanther / gdrive_download.js
Last active February 25, 2022 15:57
Download A Google Drive File via Javascript
function downloadGDriveFile (file) {
if (file.downloadUrl) {
var accessToken = gapi.auth.getToken().access_token;
var xhr = new XMLHttpRequest();
xhr.open('GET', file.downloadUrl);
xhr.setRequestHeader('Authorization', 'Bearer ' + accessToken);
xhr.onload = function() {
var content = xhr.responseText;
do_something_with_file_content(file.title, content);
};
@pizzapanther
pizzapanther / themes.less
Last active August 29, 2015 14:01
Less for each loop for theme building
// .for
.for(@i, @n) {.-each(@i)}
.for(@n) when (isnumber(@n)) {.for(1, @n)}
.for(@i, @n) when not (@i = @n) {
.for((@i + (@n - @i) / abs(@n - @i)), @n);
}
// .for-each
.for(@array) when (default()) {.for-impl_(length(@array))}
.for-impl_(@i) when (@i > 1) {.for-impl_((@i - 1))}
@pizzapanther
pizzapanther / base.py
Created September 21, 2014 22:23
App Engine RDBMS Update: google/storage/speckle/python/django/backend/base.py
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#