Skip to content

Instantly share code, notes, and snippets.


Peter Hanley hanleybrand

View GitHub Profile
hanleybrand /
Created Feb 28, 2014
add 'authenticated users' (i.e. anyone logged in) read privileges to presentations (in django shell_plus) - can be edited and run, or copy/pasted into the shell
from rooibos.presentation.models import Presentation
from rooibos.access.models import ExtendedGroup, AUTHENTICATED_GROUP, AccessControl
from django.contrib.contenttypes.models import ContentType
from rooibos.contrib.tagging.models import Tag, TaggedItem
# lets get the stuff we need
# user (owner) - edit that, of course
usr = User.objects.get(username='someuser')
# content-type, in this case presentation
hanleybrand /
Last active Aug 29, 2015
Environment debugging for MDID3 - paste this to the bottom of your and run the server with `python run server`
import os
PROJECT_ROOT = os.path.normpath(os.path.join(os.path.dirname(__file__), '..'))
ROOIBOS_ROOT = os.path.normpath(os.path.join(os.path.dirname(__file__)))
# This will print a fair amount of information helpful for debugging an installation
# if CL_DEBUG = True at the beginning of this file
hanleybrand / out
Last active Aug 29, 2015
mdid django 1.6 errors
View out
## for this log I replaced my virtualenv path to ////////python/
## and the path to mdid is changed to ~~~~~~~~~~~~~~~~~~~>mdid_root/
## for visual purposes
$ ./
__name__ = config.settings_local
__file__ = ~~~~~~~~~~~~~~~~~~~>mdid_root/config/settings_local.pyc
os.getpid() = 9262
### this is a script for a user (with sudo privs if launching mysql) to run.
### it's a script I use for developing on a mac, so it will need tweaking to run
### on linux systems (i.e. it will need all of the init.d, service stuff addded)
### it requires an argument - start|stop|restart|procs|pids
### start|stop|restart are as expected,
### procs invokes pgrep -fl for solr, rabbitmq, mysql and "python runworkers"
### pids invokes pgrep -f for solr, rabbitmq, mysql and "python runworkers"
hanleybrand / test.sh_out
Created May 28, 2014
View test.sh_out
$ ./
Scratch directory for this test session is /var/folders/b2/qyttf5ps2ysdcd7jwhj5s1fr0000gn/T/tmpqtkPbT
TESTING =========== 1 =================== 2 ================== 3
Creating test database for alias 'default' ('test_test_test_mdid')...
Creating tables ...
Creating table django_content_type
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
hanleybrand /
Created May 31, 2014
Django [copy database] - management command
from optparse import make_option
from django.core import serializers
from django.db.models import get_app, get_models
__author__ = 'mikhailturilin'
from import BaseCommand
hanleybrand / webapp_vpat
Last active Aug 29, 2015 — forked from anonymous/webapp_vpat
Section 1194.22 Web-based Internet information and applications – Detail VPAT™ Voluntary Product Accessibility Template® source:
View webapp_vpat
(a) A text equivalent for every non-text element shall be provided (e.g., via "alt", "longdesc", or in element content).
(b) Equivalent alternatives for any multimedia presentation shall be synchronized with the presentation.
(c) Web pages shall be designed so that all information conveyed with color is also available without color, for example from context or markup.
(d) Documents shall be organized so they are readable without requiring an associated style sheet.
(e) Redundant text links shall be provided for each active region of a server-side image map.
(f) Client-side image maps shall be provided instead of server-side image maps except where the regions cannot be defined with an available geometric shape.
(g) Row and column headers shall be identified for data tables.
(h) Markup shall be used to associate data cells and header cells for data tables that have two or more logical levels of row or column headers.
(i) Frames shall be titled with text that facilitates frame identification and navigation
hanleybrand / gist:ee260b53dfb404f5055a
Created Jul 2, 2014
traceback for stackoverflow question
View gist:ee260b53dfb404f5055a
Request Method: POST
Request URL:
Django Version: 1.6.5
Python Version: 2.7.6
Installed Applications:
hanleybrand / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
hanleybrand / min max dates on bb learn activity accumulator tables.sql
Created Dec 15, 2014
Blackboard Learn Activity Accumulator - min/max dates (bb60 schema)
View min max dates on bb learn activity accumulator tables.sql
-- checks the min/max dates on your activity accumulator tables
MIN(prod.TIMESTAMP)as 'AA min date bb60'
, MAX(prod.TIMESTAMP) as 'AA max date bb60'
,(SELECT MIN(TIMESTAMP) FROM bb_bb60_stats.dbo.ACTIVITY_ACCUMULATOR) as 'AA min date bb60_stats'
,(SELECT MAX(TIMESTAMP) FROM bb_bb60_stats.dbo.ACTIVITY_ACCUMULATOR) as 'AA min date bb60_stats'