Skip to content

Instantly share code, notes, and snippets.

Artisanal bits built just for you!

Frank Wiles frankwiles

Artisanal bits built just for you!
View GitHub Profile
frankwiles / Usage in Ipython
Created Jul 12, 2019
Keeping Django Models Ordered Example
View Usage in Ipython
from tasks.models import *
t = Task.objects.create(name="Test1")
s1 = Step.objects.create(task=t, name="Testing1")
s2 = Step.objects.create(task=t, name="Testing2")
s3 = Step.objects.create(task=t, name="Testing3")
s4 = Step.objects.create(task=t, name="Testing4")
# Show the existing numbers/structure

Keybase proof

I hereby claim:

  • I am frankwiles on github.
  • I am frankwiles ( on keybase.
  • I have a public key whose fingerprint is 782D A1E3 A547 E219 FD44 C7A0 BDE8 83DD D590 08CA

To claim this, I am signing this object:

from logbook import Logger, FileHandler
log = Logger('my-example-logger')"Testing")
# Output in ./output.log
# [2016-05-19 20:53:53.095826] INFO: my-example-logger: Testing
frankwiles /
Created May 17, 2015
Code and Markdown blocks for Wagtail 1.0 StreamField
from django.utils.safestring import mark_safe
from markdown import markdown
from pygments import highlight
from pygments.formatters import get_formatter_by_name
from pygments.lexers import get_lexer_by_name
from wagtail.wagtailcore import blocks
class CodeBlock(blocks.StructBlock):
frankwiles / gist:5101648
Created Mar 6, 2013
AWS CORS configuration
View gist:5101648
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="">
frankwiles / gist:4024500
Created Nov 6, 2012
Rebuild a broken Python virtualenv on heroku
View gist:4024500
# Execute these commands in order to rebuild a virtualenv from scratch
$ heroku labs:enable user-env-compile
$ heroku config:set CLEAN_VIRTUALENV=yes
$ heroku config:set VIRTUALENV_DIRS=.heroku/venv
$ git push heroku master
$ heroku config:unset CLEAN_VIRTUALENV
$ heroku config:unset VIRTUALENV_DIRS
$ heroku labs:disable user-env-compile
frankwiles / first-five.sql
Created Sep 14, 2012
Index on first 5 characters of a column
View first-five.sql
title varchar(20),
CREATE INDEX firstfive_idx ON song WHERE substring(title, 0, 6);
SELECT * FROM song WHERE substring(title, 0, 6) = 'foobar1' AND title='foobar1bazbazwheeheee!';
frankwiles / gist:3531321
Created Aug 30, 2012
vim trailing whitespace
View gist:3531321
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
autocmd BufWinLeave * call clearmatches()
frankwiles / gist:2051463
Created Mar 16, 2012
RFC valid E-mail address regular expression
View gist:2051463
frankwiles /
Created Aug 29, 2011
Awk is horrible, use Python
#!/usr/bin/env python
import re
import fileinput
good_match = re.compile(r'sip:\+?[0-9]+@')
for line in fileinput.input():
parts = line.split('|')
You can’t perform that action at this time.