Skip to content

Instantly share code, notes, and snippets.

View hanleybrand's full-sized avatar

Peter Hanley hanleybrand

View GitHub Profile
@hanleybrand
hanleybrand / test_metadata.json
Created January 27, 2014 02:20
example metadata json from import_presentation.py
metadata: [
{
"value": "SL-20TILW025",
"label": "ID"
},
{
"value": "Zeitungsstapel",
"label": "Title"
},
{
@hanleybrand
hanleybrand / import_presentation.py
Created January 27, 2014 03:15
snippet from import_presentation -- see https://gist.github.com/hanleybrand/8642400 for sample metadata
from rooibos.data.models import Record, standardfield, Field, FieldValue, Collection, CollectionItem
from rooibos.presentation.models import Presentation, PresentationItem
from rooibos.storage.models import Media, Storage
from rooibos.util import guess_extension
import simplejson
import requests
from PIL import Image
from StringIO import StringIO
from django.contrib.auth.models import User
@hanleybrand
hanleybrand / mdid_admin_tricks_pres_perms.py
Created February 28, 2014 22:06
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
hanleybrand / bb-vargrant-notes.sh
Last active February 4, 2020 16:02
Blackboard vagrant up and away
# start bb vm
cd ~/hackboard
vagrant up
# ssh via vagrant
vagrant ssh
## alternative ssh - use credentials vagrant/vagrant
ssh vagrant@localhost:2222
@hanleybrand
hanleybrand / add_to_settings_local.py
Last active August 29, 2015 14:01
Environment debugging for MDID3 - paste this to the bottom of your settings_local.py and run the server with `python manage.py run server`
import os
CL_DEBUG = True
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
hanleybrand / out
Last active August 29, 2015 14:01
mdid django 1.6 test.sh errors
## for this log I replaced my virtualenv path to ////////python/
## and the path to mdid is changed to ~~~~~~~~~~~~~~~~~~~>mdid_root/
## for visual purposes
$ ./test.sh
======CL_DEBUG=True=================================
__name__ = config.settings_local
__file__ = ~~~~~~~~~~~~~~~~~~~>mdid_root/config/settings_local.pyc
os.getpid() = 9262
@hanleybrand
hanleybrand / mdid_init.sh
Last active August 29, 2015 14:01
mdid_init_d
#!/bin/bash
### 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 manage.py runworkers"
### pids invokes pgrep -f for solr, rabbitmq, mysql and "python manage.py runworkers"
@hanleybrand
hanleybrand / test.sh_out
Created May 28, 2014 16:12
updated_dj16_test_results
$ ./test.sh
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')...
Syncing...
Creating tables ...
Creating table django_content_type
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
@hanleybrand
hanleybrand / copy_db.py
Created May 31, 2014 13:45
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 django.core.management.base import BaseCommand
@hanleybrand
hanleybrand / webapp_vpat
Last active August 29, 2015 14:02 — forked from anonymous/webapp_vpat
Section 1194.22 Web-based Internet information and applications – Detail VPAT™ Voluntary Product Accessibility Template® source: http://www.itic.org/public-policy/accessibility
(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
(j)