Skip to content

Instantly share code, notes, and snippets.

View jaymzcd's full-sized avatar
🍜
Maybe cooking some pad thai

jaymz campbell jaymzcd

🍜
Maybe cooking some pad thai
View GitHub Profile
ffmpeg -i Skyline-r5.avi -s 624x352 -b 1000k -vcodec wmv2 -ar 44100 -ab 56000 -ac 2 -y skyline.wmv &
update udox_posts set post_content=replace(post_content, "http://localhost/UDOX/PortfolioSite/udox/", "/");
@jaymzcd
jaymzcd / canvas_textcloud.py
Created December 30, 2010 16:10
Makes an HTML file with a canvas element and lots of fillText commands which create a sort of messy wordcloud from a file with lines and lines of sentances. Grouping is slightly dynamic based on common words.
#!/usr/bin/env python2
import string
import re
import random
EXCLUDED = ["", "\n", "a","able","about","across","after","all","almost","also","am","among","ive", "an","and","any", "im", "are","as","at","be","because","been","but","by","can","cannot","could","dear","did","do","does","either","else","ever","every","for","from","get","got","had","has","have","he","her","hers","him","his","how","however","i","if","in","into","is","it","its","just","least","let","like","likely","may","me","might","most","must","my","neither","no","nor","not","of","off","often","on","only","or","other","our","own","rather","said","say","says","she","should","since","so","some","than","that","the","their","them","then","there","these","they","this","tis","to","too","twas","us","wants","was","we","were","what","when","where","which","while","who","whom","why","will","with","would","yet","you","your"]
CANVAS_SIZE = 600
HEADER = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en
@jaymzcd
jaymzcd / text_blend.py
Created December 30, 2010 17:29
same as last thing only outputs for blender script
#!/usr/bin/env python2
import string
import re
import random
EXCLUDED = ["", "\n", "a","able","about","across","after","all","almost","also","am","among","ive", "an","and","any", "im", "are","as","at","be","because","been","but","by","can","cannot","could","dear","did","do","does","either","else","ever","every","for","from","get","got","had","has","have","he","her","hers","him","his","how","however","i","if","in","into","is","it","its","just","least","let","like","likely","may","me","might","most","must","my","neither","no","nor","not","of","off","often","on","only","or","other","our","own","rather","said","say","says","she","should","since","so","some","than","that","the","their","them","then","there","these","they","this","tis","to","too","twas","us","wants","was","we","were","what","when","where","which","while","who","whom","why","will","with","would","yet","you","your"]
CANVAS_SIZE = 20
HEADER = """
import bpy
bpy.ops.object.select_all()
@jaymzcd
jaymzcd / fluxLaunch.sh
Created January 10, 2011 13:37
There seems to be a bug whereby now with multiple screens fluxbox is messing up my $DISPLAY variable and not setting it correctly. For now I have this prepended to all my .fluxbox/menu commands to make sure it is correctly set to handle my 1 xserver + 3 x
#!/bin/bash
DISPLAY=:0.${DISPLAY:1} $1
@jaymzcd
jaymzcd / NoneFilterSpec.py
Created January 20, 2011 15:47
A filterspec to attach to your models for showing __isnull fields
class NoneFilterSpec(ChoicesFilterSpec):
"""Filters based on a field being either None or populated """
def __init__(self, f, request, params, model, model_admin):
super(NoneFilterSpec, self).__init__(f, request, params, model, model_admin)
self.lookup_kwarg = '%s__isnull' % f.name
self.lookup_val = request.GET.get(self.lookup_kwarg, None)
self.lookup_choices = [True, False]
self.lookup_choices.sort()
@jaymzcd
jaymzcd / NoneFilterSpec.py
Created January 20, 2011 15:47
A filterspec to attach to your models for showing __isnull fields
class NoneFilterSpec(ChoicesFilterSpec):
"""Filters based on a field being either None or populated """
def __init__(self, f, request, params, model, model_admin):
super(NoneFilterSpec, self).__init__(f, request, params, model, model_admin)
self.lookup_kwarg = '%s__isnull' % f.name
self.lookup_val = request.GET.get(self.lookup_kwarg, None)
self.lookup_choices = [True, False]
self.lookup_choices.sort()
@jaymzcd
jaymzcd / settings.py
Created January 24, 2011 12:03
A base for my django settings file
# Django settings for geoipredirect project.
import os
PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('jaymz', 'jaymz@u-dox.com'),
)
@jaymzcd
jaymzcd / scratchTable.sh
Created February 15, 2011 17:22
Makes a throwaway table from a flat file with lists of field names (all nullable varchars)
#!/usr/bin/env sh
echo "CREATE TABLE `basename ${1,,} ${1: -4}` ("
echo " id INTEGER AUTO_INCREMENT,"
while read line
do
no_space=${line/ /_}
field_name=${no_space,,}
echo -e " $field_name VARCHAR(50) default NULL,"
done < $1
@jaymzcd
jaymzcd / gist:842535
Created February 24, 2011 17:46
Override console.log to avoid exceptions in browsers that don't support it or where it's not enabled
if (typeof console == "undefined" || typeof console.log == "undefined") var console = { log: function() {} };