Skip to content

Instantly share code, notes, and snippets.

View gilesdring's full-sized avatar
🏠
Working from home

Giles Dring gilesdring

🏠
Working from home
View GitHub Profile
@gilesdring
gilesdring / stringFunctions.js
Last active March 22, 2024 09:56
Javascript Utilities
/**
* Split a string on whitespace, keeping within a maximum line length
*/
export function splitOnWhitespace(source, maxLength=90) {
// If shorter than the maxLength, just return the source in an array
if (source.length <= maxLength) {
return [source];
}
// Find all space characters
@gilesdring
gilesdring / keycloak-signups.sh
Created December 7, 2021 17:31
Extract signups from keycloak
#!/bin/bash
[[ -z ${HOST} || -z ${ADMIN_PASSWORD} || -z ${REALM} ]] && echo Make sure HOST, ADMIN_PASSWORD and REALM are set > /dev/stderr && exit 1
ACCESS_TOKEN=$(curl \
--silent \
--data "client_id=admin-cli" \
--data "username=admin" \
--data "password=${ADMIN_PASSWORD}" \
--data "grant_type=password" \
"${HOST}/auth/realms/master/protocol/openid-connect/token" | jq --raw-output .access_token)
@gilesdring
gilesdring / config-runner.sh
Created September 29, 2021 08:39
Standing up a gitlab-runner
# Install required software
sudo yum --assumeyes update
sudo yum --assumeyes install git docker
sudo systemctl enable docker
sudo systemctl start docker
sudo usermod -a -G docker $USER
docker ps
# Install gitlab runner
export arch=amd64
@gilesdring
gilesdring / setup_raspberry_pi.md
Last active June 21, 2021 10:14
Setting up a Rasberry Pi
@gilesdring
gilesdring / covid-19-cases-uk.ipynb
Created March 11, 2020 09:36
covid-19-cases-uk.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gilesdring
gilesdring / README.md
Last active March 15, 2024 15:35
Using the MixCloud API

https://www.mixcloud.com/developers/widget/#footerwidget

The autostart.js script will cause the main feed to start playing. This is dependent on the browser settings.

Chrome - click on media preferences in location bar (next to site address) and select allow audio and video.

Firefox seems somewhat less willing to autoplay.

Unpack this to a directory. It'll need to be running from a webserver. Simple way to do this is

@gilesdring
gilesdring / google-form-to-github-issue.md
Created September 6, 2019 08:17 — forked from bmcbride/google-form-to-github-issue.md
Create a new GitHub Issue from a Google Form submission

Wiring up a Google Form to GitHub is not that difficult with a little bit of Apps Script automation. All you need is a Google account, a GitHub account, and a web browser...

Set up your GitHub Personal Access Token

Personal access tokens provide an easy way to interact with the GitHub API without having to mess with OAuth. If you don't already have a personal access token with repo or public_repo access, visit your GitHub settings page and generate a new token.

Be sure to copy your token some place safe and keep it secure. Once generated, you will not be able to view or copy the token again.

Set up the Form & Spreadsheet

  1. Create a Google Form.
#!/usr/bin/env bash
set -e
repos=$(find . -name .git -a -type d -exec dirname {} \;)
eachRepo() {
local f
f=$*
for repo in ${repos}; do
@gilesdring
gilesdring / Configuring Rollup.js for React.md
Last active May 16, 2019 14:08
Setting up a project for React with Rollup.js

Install required Rollup stuffs

npm install --save-dev rollup rollup-plugin-babel rollup-plugin-commonjs \
    rollup-plugin-copy rollup-plugin-node-resolve rollup-plugin-replace \
    rollup-plugin-uglify

Install required Babel stuffs

@gilesdring
gilesdring / macOS Install Media.md
Last active August 10, 2020 16:08
Instructions to create installation media for macos

High Sierra (10.13)

hdiutil create -o /tmp/HighSierra.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/HighSierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build
asr restore -source /Applications/Install\ macOS\ High\ Sierra.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
hdiutil detach /Volumes/OS\ X\ Base\ System
hdiutil convert /tmp/HighSierra.cdr.dmg -format UDTO -o /tmp/HighSierra.iso
mv /tmp/HighSierra.iso.cdr ~/Desktop/HighSierra.iso