Skip to content

Instantly share code, notes, and snippets.

View davidjb's full-sized avatar

David Beitey davidjb

View GitHub Profile
@davidjb
davidjb / shibboleth-debug.md
Created October 27, 2017 01:41
Shibboleth debugging steps

Shibboleth Debugging

Throught this whole process, if you're unsure whether a Shibboleth login session worked (such as if it looks like your application isn't getting attributes etc), you can test by accessing /Shibboleth.sso/Session after going a /Shibboleth.sso/Login cycle and it'll list various details, or state:

A valid session was not found

if it didn't work or you haven't logged in yet.

@davidjb
davidjb / node20.x-bootstrap.sh
Created November 23, 2023 05:16
AWS Lambda node20.x Boostrap script
#!/bin/sh
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
if [ -z "$NODE_PATH" ];
then
nodejs_mods="/opt/nodejs/node_modules"
nodejs20_mods="/opt/nodejs/node20/node_modules"
runtime_mods="/var/runtime/node_modules"
task="/var/runtime:/var/task"
export NODE_PATH="$nodejs20_mods:$nodejs_mods:$runtime_mods:$task"
@davidjb
davidjb / configuration.yaml
Last active October 25, 2023 15:48
MQTT-based water meter configuration for Home Assistant
# MQTT Broker - mosquitto
mqtt:
broker: localhost
port: 1883
utility_meter:
water_usage_mains_hourly:
source: sensor.water_meter
cycle: hourly
water_usage_mains_daily:
@davidjb
davidjb / ffmpeg-timelapse.sh
Last active August 11, 2023 21:19
Create a timelapsed video from a collection of video files in one hit
# Create `list.txt` via https://trac.ffmpeg.org/wiki/Concatenate; aka a file with lines like:
# file 'foobar.mp4'
# file 'foobaz.mp4'
# Swap the codec as per https://www.rickmakes.com/ffmpeg-timelapse-from-video-speed-up-vs-every-n-th-frame/ if you want hardware encoding or use a different platform
# 0.002 = 500x
ffmpeg -f concat -i list.txt -an -vf "setpts=0.002*PTS" -vcodec h264_videotoolbox -b:v 10000k -r 30 -pix_fmt yuv420p out.mp4
@davidjb
davidjb / recovery.sh
Created December 21, 2016 08:21
Create macOS Sierra Recovery Partition Without Reinstalling
TARGET="/Volumes/Macintosh HD" # Specify where to configure Recovery partition
MACOS_INSTALLER="/Applications/Install\ macOS\ Sierra.app" # Path to your macOS installer
# Remaining paths ahead are dependant on OS version
# This *should* support 10.9 and above but is only tested on 10.12
curl http://support.apple.com/downloads/DL1464/en_US/RecoveryHDUpdate.dmg -L -o ~/Downloads/RecoveryHDUpdate.dmg
hdiutil mount ~/Downloads/RecoveryHDUpdate.dmg
pkgutil --expand /Volumes/Mac\ OS\ X\ Lion\ Recovery\ HD\ Update/RecoveryHDUpdate.pkg /tmp/recoveryupdate
@davidjb
davidjb / buildout.cfg
Last active July 13, 2021 10:18
Example SQLAlchemy integration with Plone
[buildout]
...
[instance]
...
eggs=
...
z3c.saconfig
zcml-additional =
@davidjb
davidjb / django-databases.sh
Last active January 12, 2021 01:11
Installation of local database servers via Docker and test running with Django and Wagtail
# Any pip/python commands should be run in a virtualenv or adapted for pipenv etc
# System-level installation commands are for Mac but are adaptable to Linux
# SQLite
# Requires Python to be built with sqlite3 support. This may require installation of
# a separate package such as `py39-sqlite3` on FreeBSD but most OSes have this support
# built in as of 2020.
DATABASE_ENGINE=django.db.backends.sqlite3 DATABASE_NAME=:memory: python runtests.py
# Postgres
@davidjb
davidjb / wagtail-6607.txt
Last active December 6, 2020 23:22
Log output of failing tests on SQL Server for https://github.com/wagtail/wagtail/pull/6607
$ DATABASE_ENGINE=sql_server.pyodbc DATABASE_DRIVER=FreeTDS DATABASE_HOST=localhost DATABASE_PORT=1433 DATABASE_USER=sa DATABASE_PASSWORD='yourStrong(!)Password' python runtests.py
Creating test database for alias 'default'...
Got an error creating the test database: ('42000', "[42000] [FreeTDS][SQL Server]Database 'test_wagtail' already exists. Choose a different database name. (1801) (SQLExecDirectW)")
I Type 'yes' if you would like to try deleting the test database 'test_wagtail', or 'no' to cancel: yes
Destroying old test database for alias 'default'...
System check identified no issues (0 silenced).
....................................F..................................................F....................................................................................................................F...............................................................................
......................................................................................................FF....................
@davidjb
davidjb / wordcloud.jsx
Created August 18, 2020 05:42
Reloadable react-wordcloud
import React, { useState } from 'react'
import { useInterval, useBoolean } from 'react-use'
import { Row, Col, Alert, Button } from 'react-bootstrap'
import ReactWordcloud from 'react-wordcloud'
import 'tippy.js/dist/tippy.css'
import 'tippy.js/animations/scale.css'
function isCanvasAllowed() {
return (
@davidjb
davidjb / acceleration-demo.html
Last active June 7, 2019 22:16
Web API demos for acceleration, compass (non-standard), directions, geolocation and more.
<!DOCTYPE html>
<html>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<body>
<script type="text/javascript" charset="utf-8">
var counter = 0;
var timeout;
window.addEventListener('devicemotion', function(event) {
var accel = event.acceleration;