Skip to content

Instantly share code, notes, and snippets.

View usernamenumber's full-sized avatar

Brad Smith usernamenumber

View GitHub Profile
import json, os, re, sys, time
from lxml import etree
"""
This tool finds and prints xAPI JSON representations of each ktouch activity it finds.
It is WAY OVER-ENGINEERED for what it needs to be, but it was also intended as a way
to play around with ideas for how this could be abstracted into a more general framework.
Here are some concepts you will need to understand:
/**
*
* This is the result of writing to an XBlock with a superclass of the Dict field, each of which have a bunch of
* logging/debug wrappers built into them. The result is somewhere between a confusing mess and an informative trip
* down the rabbit hole that is XBlock field internals. Enter if you dare. :)
*
* The code that produced this log is here:
https://github.com/usernamenumber/xb_scorm/blob/logging/xb_scorm/xb_scorm.py
@usernamenumber
usernamenumber / gist:ab4d4486430eb777cb42
Created November 14, 2014 18:35
Mockup of proposed Add Page interface for Xerte
<html>
<head>
<style>
.page_add {
border: thin solid gray;
border-radius: 10px;
width: 1050px;
padding-left: 20px;
padding-right: 20px;
height: 70%;
@usernamenumber
usernamenumber / gist:752d34b049d5000f1121
Last active August 29, 2015 14:10
Query to get approximate time spent in a course based on the difference between the first view and the last submission recorded in the log
#
# IMPORTANT:
# This query is formatted to work with Moodle's Configurable Reports plugin
# https://moodle.org/plugins/view.php?plugin=block_configurable_reports
#
select
u.username "User",
c.shortname "Course",
from_unixtime(viewed.first) "First View",
@usernamenumber
usernamenumber / gist:e7de2608545a9482d342
Created April 23, 2015 07:09
write_sd.img (non-working WIP)
#!/bin/bash
#
# Script to prepare a cubietruck SD image for x2go
# Based on work by Arturo Samanez (https://github.com/iLearner/x2go)
# and instructions at http://linux-sunxi.org/Bootable_SD_card
if [ $EUID -ne 0 ]
then
echo ""
echo "ERROR: Please run this script as root."
@usernamenumber
usernamenumber / cap.yml
Last active January 8, 2016 18:33
Playbook for edx on CAP (work in progress!)
- name: Deploy edxapp for Intel CAP
hosts: all
sudo: True
gather_facts: True
vars:
serial_count: 1
CLUSTER_NAME: 'edxapp'
#EDXAPP_LMS_NGINX_PORT: 80 # Port 18000 by default
COMMON_SSH_PASSWORD_AUTH: 'yes'
COMMON_ENABLE_DATADOG: 'false'
@usernamenumber
usernamenumber / process_html-3.py
Last active May 14, 2016 01:05
Example script to convert external images into base64-encoded content embedded into the HTML, plus HTML cleanup and restructuring
#!/usr/bin/python
##
## This script does initial cleanup of an HTML export of the CSE book from gdocs
## After cleanup, it will probably need to be imported back into gdocs for manual
## tweaks.
##
## Usage: just pass one or more HTML filenames as arguments.
## Processed versions are output to `dstdir`, defined below.
##
# coding: utf-8
"""
Exercise solution: given two string representations of binary numbers, return their sum as a string representation of a binary number.
This solution assumes that a much simpler solution like...
def badd(a,b):
return bin(int(a,2) + int(b,2))[2:]
...wouldn't be accepted. ;)
#!/bin/bash
# Set these to your locations...
CSEDIR="~/Documents/Tunapanda/EconApp/Book/funzo-cse"
FUNZODIR="~/Documents/Tunapanda/EconApp/Book/funzo-app"
cd $CSEDIR &&
# Remove old content
rm -rf publish/* ;
@usernamenumber
usernamenumber / index.html
Last active April 13, 2022 02:21
JIT tree demo
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!--
Adapted from http://philogb.github.io/jit/static/v20/Jit/Examples/Spacetree/example1.html
-->
<head>