Skip to content

Instantly share code, notes, and snippets.


Lance E Sloan «UMich» lsloan

  • @tl-its-umich-edu - Teaching & Learning, ITS, Univ. of Michigan
  • Ann Arbor, Michigan, USA
View GitHub Profile
lsloan / v1p0p0.php
Created Apr 19, 2019
Parse hangouts.json from Google Takeout, via
View v1p0p0.php
(in this version, I added support for more message types and offer both plaintext and HTML message format)
This is a function that transforms the JSON you get from Google Takeout when you export your Hangouts history
into a PHP array which can be used to further manipulate the data.
A use case is my hangouts parser at -- a description can be seen at

perl -e '$_ = "wftedskaebjgdpjgidbsmnjgc";tr/a-z/oh, turtleneck Phrase Jar!/; print;'

lsloan / gist:bad9f599695cc35d76402453624faa38
Created Jan 18, 2019 — forked from perusio/gist:1724301
Workaround in PHP cURL for the 100-continue expectation
View gist:bad9f599695cc35d76402453624faa38
// cURL obeys the RFCs as it should. Meaning that for a HTTP/1.1 backend if the POST size is above 1024 bytes
// cURL sends a 'Expect: 100-continue' header. The server acknowledges and sends back the '100' status code.
// cuRL then sends the request body. This is proper behaviour. Nginx supports this header.
// This allows to work around servers that do not support that header.
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
// We're emptying the 'Expect' header, saying to the server: please accept the body right now.
// Read here:
def find(key, dictionary):
for k, v in dictionary.items():
if k == key:
yield v
elif isinstance(v, dict):
for result in find(key, v):
yield result
elif isinstance(v, list):
for d in v:
for result in find(key, d):
View EventMediaPausedVideoMultiContextTest.php
require_once 'CaliperTestCase.php';
use IMSGlobal\Caliper\actions\Action;
use IMSGlobal\Caliper\context\Context;
use IMSGlobal\Caliper\entities\agent\Organization;
use IMSGlobal\Caliper\entities\agent\Person;
use IMSGlobal\Caliper\entities\agent\SoftwareApplication;
use IMSGlobal\Caliper\entities\lis\CourseSection;
use IMSGlobal\Caliper\entities\lis\Membership;
View caliperEventMediaPausedVideoMultiContext.json
"@context": ["", ""],
"id": "urn:uuid:956b4a02-8de0-4991-b8c5-b6eebb6b4cab",
"type": "MediaEvent",
"actor": {
"id": "",
"type": "Person"
"action": "Paused",
"object": {
lsloan /
Created Nov 1, 2018 — forked from scriptingosx/
bash functions using osascript to use some user interaction on macOS
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
consoleUser() {
python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\n");'
displaydialog() { # $1: message
lsloan /
Created Oct 5, 2018 — forked from ericlathrop/
Convert MH mail folders to MBOX files, which are used by Mozilla Thunderbird.
# By Eric Lathrop <>
# Convert MH mail folders to MBOX files
# Useful for switching to Mozilla Thunderbird
# Copy this script to ~/Mail/ and execute.
#!/bin/sh --
# delete pods that have a status of "Completed" or "Error"
oc get pods | tail -n +2 | awk '($3 == "Completed" || $3 == "Error") {print $1}' | xargs -I% -L1 oc delete pod/%
You can’t perform that action at this time.