Skip to content

Instantly share code, notes, and snippets.

View damoclark's full-sized avatar

Damien Clark damoclark

View GitHub Profile
@damoclark
damoclark / php_unserialize_to_json.sql
Last active February 3, 2021 09:26 — forked from storeman/php_unserialize_to_json.sql
PHP unserialize in Postgresql to json
/**
Decode a php serialized value to json. This function only supports basic
data types:
- arrays (will always become a json object)
- booleans
- integers
- floats
- strings
- NULL
@damoclark
damoclark / raspi-config.txt
Last active January 28, 2024 12:03
Simple Raspbian Configuration Tool. Add file to boot partition of SD Card and run single command after booting Raspbian.
#/bin/sh
#
# Don't change the following lines unless you know what you are doing
# They execute the config options starting with 'do_' below
grep -E -v -e '^\s*#' -e '^\s*$' <<END | \
sed -e 's/$//' -e 's/^\s*/\/usr\/bin\/raspi-config nonint /' | bash -x -
#
############# INSTRUCTIONS ###########
#
# Change following options starting with 'do_' to suit your configuration
@damoclark
damoclark / bedifferent-renumber.user.js
Last active August 4, 2020 01:18
Bedifferent Renumbering
This file has been truncated, but you can view the full file.
// ==UserScript==
// @name bedifferent-editing-toolkit
// @description Editing toolkit for designers working on the CQUni BeDifferent Moodle Platform
// @version 1.0.3
// @grant none
// @noframes
// @include https://bedifferent.cqu.edu.au/*
// @include https://u-bedifferent.catalyst-au.net/*
// @include https://staging-bedifferent.catalyst-au.net/*
// ==/UserScript==
@damoclark
damoclark / createElement.mjs
Created March 22, 2023 02:31
Very basic html template function for javascript
/**
* Create an Element from string using template tag for insertion into DOM
* @param {string} html
* @return {Element}
*/
function createElement(html) {
if(html === null || html === undefined)
return null ;
const element = window.document.createElement('template') ;
element.innerHTML = html ;