Skip to content

Instantly share code, notes, and snippets.

View hanleybrand's full-sized avatar

Peter Hanley hanleybrand

View GitHub Profile
@hanleybrand
hanleybrand / make_monthly_pptx.py
Created July 23, 2019 16:49
Create monthly PPT reports
from datetime import date
from string import Template
from pptx import Presentation
# this file must exist
template = 'x_Academic Apps-y.pptx'
prs = Presentation(template)
fy = ['2018', '2019']
@hanleybrand
hanleybrand / clean_attrs.py
Last active February 12, 2023 04:38
Remove unwanted attributes from tags in HTML snippets with BeautifulSoup (3.21 - might work with BS4)
from BeautifulSoup import BeautifulSoup
def clean(html):
whitelist = ['backColor', 'backcolor', 'bgcolor',
'color', 'fg', 'fontName', 'fontSize',
'fontname', 'fontsize', 'href', 'name',
'textColor', 'textcolor']
html.attrs = None
for e in html.findAll(True):
for attribute in e.attrs:
@hanleybrand
hanleybrand / add_users_via_json.py
Created December 4, 2018 15:41
create users for mdid3 from a json source - management command, only a start
import requests
import simplejson as json
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand
from optparse import make_option
from django.core.validators import email_re
from django.db import IntegrityError
from django.conf import settings
import logging
@hanleybrand
hanleybrand / solr 7 centos bash.md
Last active November 19, 2018 17:56
Instructions for setting up solr 7 for mdid

Get solr and save it locally, and untar it

mkdir ~/solr_install
cd ~/solr_install
wget http://apache.claz.org/lucene/solr/7.2.1/solr-7.2.1.tgz
tar xzf solr-7.2.1.tgz solr-7.2.1/bin/install_solr_service.sh --strip-components=2

run the installer – note the -u specifies that solr runs as the mdid user which hopefully has more advantages than disadvantages (for me it was not having to switch so many accounts)

@hanleybrand
hanleybrand / TF_portal.tml
Last active May 1, 2018 13:52
Minecraft Forge - Twilight Forest + Ruins
# Created by Ruins mod version 17.0 Ingame Parser . - http://www.atomicstryker.net/ruins.php
# authoring Player: hanleybrand
# place in generic folder for the TF portal to spawn in overworld biomes
# test with /testruin generic/TF_portal ~5 ~ ~5
# (if you don't put the offset coords in, you'll immediately be in TF)
weight=1
embed_into_distance=7
acceptable_target_blocks=
<div id="bean-hero-video-single-cta-full-group-media-wrapper" class=" group-media-wrapper field-group-div">
<div class="field field-name-field-hero-image field-type-image field-label-hidden">
<img typeof="foaf:Image"
src="https://www.temple.edu/sites/temple/files/Screen%20Shot%202017-06-28%20at%209.07.25%20AM_0.png"
alt="Person in dark room."></div>
<div class="field field-name-field-video-background-image field-type-image field-label-hidden">
<img typeof="foaf:Image"
src="https://www.temple.edu/sites/temple/files/Screen%20Shot%202017-06-28%20at%209.07.25%20AM_0_0.png"
alt="Person in dark room."></div>
@hanleybrand
hanleybrand / sqlsrv_create_lti2apps.sql
Last active January 26, 2023 14:45
Create MS SQL Server tables (lti2_*) for LTI-Tool-Provider-Library-PHP https://github.com/IMSGlobal/LTI-Tool-Provider-Library-PHP
-- creates the tables necessary to use the LTI provider library for SQL Server (tested against SQL Server 12.0.5540.0 (2014 Service Pack 2)
-- see [https://github.com/IMSGlobal/LTI-Tool-Provider-Library-PHP](LTI-Tool-Provider-Library-PHP)
CREATE TABLE lti2_consumer
(
consumer_pk INT IDENTITY (1, 1) PRIMARY KEY NOT NULL,
name VARCHAR(50) NOT NULL,
consumer_key256 VARCHAR(256) NOT NULL,
consumer_key TEXT NULL,
secret VARCHAR(1024) NOT NULL,
@hanleybrand
hanleybrand / gist:8e88211bda55f1d165b7efa791d763b5
Created May 19, 2017 19:07 — forked from brent20/gist:3692482
BLTI Navigation External tool- External Link inside of Instructure Canvas - Brent Saltzman, Creighton University
<cartridge_basiclti_link xmlns="http://www.imsglobal.org/xsd/imslticc_v1p0"
xmlns:blti="http://www.imsglobal.org/xsd/imsbasiclti_v1p0"
xmlns:lticm="http://www.imsglobal.org/xsd/imslticm_v1p0"
xmlns:lticp="http://www.imsglobal.org/xsd/imslticp_v1p0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.imsglobal.org/xsd/imslticc_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticc_v1p0.xsd http://www.imsglobal.org/xsd/imsbasiclti_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imsbasiclti_v1p0.xsd http://www.imsglobal.org/xsd/imslticm_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticm_v1p0.xsd http://www.imsglobal.org/xsd/imslticp_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticp_v1p0.xsd">
<blti:title>External non-BLTI URL</blti:title>
<blti:description>This tool adds a Course Navigation item to a URL specified in the URL tag, after configuration it can be found under the navigation settings</blti:description>
<blti:launch_url>https://lti-examples.heroku.com/tool_r
@hanleybrand
hanleybrand / users_notenrolled_notlog.sql
Last active May 9, 2017 14:57 — forked from enriquemanuel/users_notenrolled_notlog.sql
Oracle SQL - Bb Learn - Finding Users that have not logged in to the System and are not enrolled in any course
-- Finding Users that have not logged in to the System and are not enrolled in any course
SELECT u.user_id, u.last_login_date
FROM BBLEARN.users u WHERE NOT EXISTS (SELECT pk1 FROM BBLEARN.course_users WHERE users_pk1=u.pk1 )
and u.last_login_date is null
-- and u.system_role = 'N' -- if we want to limit by the system role
order by user_id asc;

Common Queries for Beginners

December 17, 2010 12:01 PM

Hello Everyone. Below is a list of common queries a gentlemen at Blackboard Managed Hosting gave me a while back. This list of queries is a great starting point to get to know the ASR side of Blackboard. There are a few things you need to be aware of before copying and pasting these into your favorite query analyzer:

Aqua Data Studio does not end its statements with semicolons like this ;

Some queries may not work without modification.