Skip to content

Instantly share code, notes, and snippets.

View mitchellrj's full-sized avatar

Richard Mitchell mitchellrj

View GitHub Profile
@mitchellrj
mitchellrj / interact.py
Last active December 18, 2015 17:08
Basic remote Python interpreter. Connects to a remote host and presents the Python interpreter.
"""
Basic remote Python interpreter
===============================
Connects to a remote host and presents the Python interpreter to it.
Example usage
-------------
On Machine A (the local host)::
@mitchellrj
mitchellrj / ct_aux.js
Last active December 28, 2015 18:29
Beautified CarTrawler Accelerate API wrapper, revision 56251
/*
* Cartrawler AJAX Booking Engine
* http://www.cartrawler.com
*
* Copyright (c) 2006-2013 Cartrawler.com
* Version: 56251
* Date: 13-11-2013 - 12:54
*/
(function ($) {
namespace("CT.ABE.Utils.RentalCondition");
@mitchellrj
mitchellrj / patches.py
Created December 4, 2013 17:56
Quick and dirty monkey-patch for Django issue #21554. https://code.djangoproject.com/ticket/21554
def patch_21554():
"""See https://code.djangoproject.com/ticket/21554 """
try:
from collections import UserDict
except ImportError:
from UserDict import UserDict
class OneToOneDict(UserDict):
def __init__(self, *args, **kwargs):
@mitchellrj
mitchellrj / django_bash_completion
Last active December 30, 2015 11:19
Bash & Zsh autocompletion for Django with extra options (based on Django 1.6)
# #########################################################################
# This bash script adds tab-completion feature to django-admin.py and
# manage.py.
#
# Testing it out without installing
# =================================
#
# To test out the completion without "installing" this, just run this file
# directly, like so:
#
@mitchellrj
mitchellrj / Dogeoverlay.js
Created December 9, 2013 16:27
Dogeoverlay
$(document).ready(function () {
"use strict";
var items = Array(
'such currency',
'wow',
'amaze',
'much coin',
'awesome',
'so crypto',
@mitchellrj
mitchellrj / inliner.py
Last active May 4, 2016 09:38
CSS inliner
"""
Take an HTML document and replace all CSS with inline styles, accounting
for all precedence rules. Requires cssutils, cssselect and lxml.Does not
work with pseudo-elements, @font-face, @page and CSS variables as these
cannot be represented by inline CSS.
Usage::
inline_css(html_string, page_url, medium)
@mitchellrj
mitchellrj / media_query.py
Created January 17, 2014 18:06
Basic CSS3 media query parsing for Python & testing against a dictionary of characteristics
import fractions
import re
def parse_media_query(media_query):
class Grouping(object):
def __init__(self, parent, *args):
self.parent = parent
@mitchellrj
mitchellrj / README.md
Created May 30, 2014 15:54
Draytek Vigor SNMP monitoring with Cacti

This is based on the outdated, official Cacti configuration for ADSL Line and modified for Draytek Vigor support.

Changes from the original include:

  • Extra data sources
  • Removed unimplemented data sources
  • Updated for newer versions of Cacti

Installation & Usage

  1. Download this gist as a .zip file by clicking the button to the left labelled "Download Gist"
@mitchellrj
mitchellrj / keybase.md
Created July 8, 2014 11:14
keybase.md

Keybase proof

I hereby claim:

  • I am mitchellrj on github.
  • I am mitchell (https://keybase.io/mitchell) on keybase.
  • I have a public key whose fingerprint is 7F06 1B87 5590 ED92 5FE4 DCD3 27AA 9799 D267 327E

To claim this, I am signing this object:

@mitchellrj
mitchellrj / gist:12acfd703bc75beb0236
Last active August 29, 2015 14:04
Python multiple inheritance and super
>>> class MetaMeta(object):
... def __init__(self):
... print ('metameta')
...
>>> class Meta(MetaMeta):
... def __init__(self):
... print ('meta1')
...
>>> class Meta2(MetaMeta):
... def __init__(self):