Skip to content

Instantly share code, notes, and snippets.

View tobyontour's full-sized avatar

Toby Bettridge tobyontour

View GitHub Profile
@tobyontour
tobyontour / gist:7156857
Created October 25, 2013 15:49
Check that you're in a python virtualenv before running targets in a Makefile
coverage: checkvenv
coverage run manage.py test django_project ; coverage html
checkvenv:
@[ -z "$(VIRTUAL_ENV)" ] && (echo "Not in virtualenv"; false) || true
@tobyontour
tobyontour / Track mysql inserts
Last active December 28, 2015 00:29
Track the counts of msql inserts, updates and created tmp tables
mysqladmin ext | grep -e 'Com_\(update\|select\|insert\|delete\)\|Created'
#!/bin/bash
while true
do
inotifywait responsive.less less/*.less
lessc responsive.less >responsive.css
done
@tobyontour
tobyontour / validate.py
Created February 12, 2014 16:49
Simple python script to validate HTML
from contextlib import closing
import urllib2
import html5lib
import sys
f = urllib2.urlopen(sys.argv[1])
data = f.read()
f.close()
parser = html5lib.HTMLParser()
dociument = parser.parse(data)
@tobyontour
tobyontour / gist:6108af8be09c68ae1768
Created December 3, 2014 14:52
Test redirect location in Django
self.assertTrue(expected_location in response['Location'])
#!/bin/sh
# Put in .git/hooks/post-checkout
# Makes doing timesheets a little easier. :-)
# --- Command line
oldrev="$1"
newrev="$2"
changed_branch="$3"
if [ $changed_branch -eq "1" ]
then
tshark -f "tcp port 80 and host <ip address>" -R http
@tobyontour
tobyontour / tmp.php
Created August 13, 2015 15:40
Using JpnForPhp in Drupal
<?php
// The class you want to use
use JpnForPhp\Analyzer\Analyzer;
/**
* Implements hook_libraries_info().
*
* For defining external libraries.
*/
@tobyontour
tobyontour / vimrc
Last active October 12, 2017 12:40
ab vdd print "<pre>"; var_dump($x); die();
ab eln echo __FILE__.':'.__LINE__."\n";
set tabstop=2
set softtabstop=2
set shiftwidth=2
set expandtab
vmap <C-c> "+yi
vmap <C-x> "+c
vmap <C-v> c<ESC>"+p
imap <C-v> <C-r><C-o>+
{"version":1,"resource":"file:///home/toby/Projects/polychrome/users/admin.py","entries":[{"id":"FgtH.py","timestamp":1655671850085}]}