Skip to content

Instantly share code, notes, and snippets.

Avatar

Peter Hanley hanleybrand

View GitHub Profile
@hanleybrand
hanleybrand / ct_extended_glasses.zs
Last active Feb 25, 2020
WIP ContentTweaker script to create glowing, reinforced and glowing-reinforced variants of the various glass blocks.
View ct_extended_glasses.zs
#loader contenttweaker
import mods.contenttweaker.VanillaFactory;
import mods.contenttweaker.Block;
import mods.contenttweaker.Item;
// ref values
// glass/glowstone 0.3 hardness, 1.5 resistance
// hardened glass (education edition), 10 hardness, unknown resistance
View dropt.zs
#debug
import mods.dropt.Dropt;
import crafttweaker.item.IItemStack;
// change conquest plant blocks to only drop their items if broken with a hoe in order to
// cut down on inventory bloat
Dropt.list("conquest_drops")
.add(Dropt.rule()
@hanleybrand
hanleybrand / secrit_flags.yaml
Last active Aug 23, 2019
All the secret things in Canvas? *aug 2019
View secrit_flags.yaml
---
google_docs_domain_restriction:
state: hidden
display_name:
features.google_docs_domain_restriction: Google Docs Domain Restriction
description:
google_docs_domain_restriction_description: |-
Google Docs Domain Restriction allows Google Docs submissions and collaborations
to be restricted to a single domain. Students attempting to submit assignments or
join collaborations on an unapproved domain will receive an error message notifying them
@hanleybrand
hanleybrand / make_monthly_pptx.py
Created Jul 23, 2019
Create monthly PPT reports
View make_monthly_pptx.py
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 Mar 19, 2019
Remove unwanted attributes from tags in HTML snippets with BeautifulSoup (3.21 - might work with BS4)
View clean_attrs.py
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 Dec 4, 2018
create users for mdid3 from a json source - management command, only a start
View add_users_via_json.py
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 Nov 19, 2018
Instructions for setting up solr 7 for mdid
View solr 7 centos bash.md

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
Minecraft Forge - Twilight Forest + Ruins
View TF_portal.tml
# 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=
View temple home page video snippet.html
<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 Jun 29, 2017
Create MS SQL Server tables (lti2_*) for LTI-Tool-Provider-Library-PHP https://github.com/IMSGlobal/LTI-Tool-Provider-Library-PHP
View sqlsrv_create_lti2apps.sql
-- 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,