Skip to content

Instantly share code, notes, and snippets.

View davidjb's full-sized avatar

David Beitey davidjb

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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 / snx_ir_ctl-README-translated.md
Last active October 29, 2017 03:31
SNX IR CTRL Documentation
IR_CTRL
SN98601 IO port SN98660 IO port SN98661 IO port Design function Remarks
MS1_IO2 MS1_IO2 MS1_IO2 IR CUT Drive Control Output A
AUD1_IO3 AUD_IO0 AUD_IO0 Infrared Lamp Control
AUD1_IO4 AUD_IO1 AUD_IO1 IR CUT Drive Control Output B
MS1_IO5 AUD_IO2 AUD_IO2 Day / Night mode Detection Port
MS1_IO6 AUD_IO3 AUD_IO3 Sensor Power Control H: Enable L: Disable
MS1_IO7 AUD_IO4 AUD_IO4 Speaker SNAP01 Control H: Enable L: Disable
@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 / disable-fixed-bg.html
Created October 10, 2017 01:14
Short snippet for disabling all fixed backgrounds on a HTML page
<style>
[style], * {
background-attachment: scroll !important;
}
</style>
@davidjb
davidjb / rpm-guide.rst
Last active August 31, 2017 04:40
Helpful resources for RPM building