Skip to content

Instantly share code, notes, and snippets.

@Shogan
Shogan / RIPPLES.BAS
Last active February 23, 2022 19:54
A simple, retro screensaver written in QBasic
DECLARE SUB delay (seconds!)
SCREEN 13
RANDOMIZE TIMER
DIM prevCircX(1 TO 360)
DIM prevCircY(1 TO 360)
DIM prevInCircX(1 TO 360)
DIM prevInCircY(1 TO 360)
DO
@Shogan
Shogan / quantize.js
Created September 3, 2021 20:32
convert aisatana MIDI notes to 32 x phrases as alda compatible strings
// the Aisatana track MIDI notes
const notes = [
{
"name": "E3",
"midi": 52,
"time": 0,
"velocity": 0.30708661417322836,
"duration": 0.5882355
},
{
@Shogan
Shogan / run.sh
Created November 25, 2020 23:02
docker-compose as a docker container on any arch, including ARM
#!/bin/sh
#
# Forked from https://raw.githubusercontent.com/linuxserver/docker-docker-compose/master/run.sh
#
# Run docker-compose in a container
#
# This script will attempt to mirror the host paths by using volumes for the
# following paths:
# * $(pwd)
# * $(dirname $COMPOSE_FILE) if it's set
@Shogan
Shogan / docker-compose.yml
Last active August 28, 2021 18:39
Example docker-compose services to run on ARM Graviton2 based instances under Docker with Traefik v2 routing. See https://www.shogan.co.uk/how-tos/minimal-cost-web-hosting-with-spot-graviton2-efs-traefik-lets-encrypt/ for more info.
version: "3"
networks:
web:
external: true
internal:
external: false
services:
blog:
@Shogan
Shogan / example-traefik-dynamic.toml
Created November 21, 2020 16:44
an example of a traefik dynamic toml configuration
[http.middlewares.simpleAuth.basicAuth]
users = [
"YourUsername:$apr1$bJDZ0TQm$IBSNb2xcRsYrIdcJxNG1h."
]
[http.routers.api]
rule = "Host(`dashboard.example.com`)"
entrypoints = ["websecure"]
middlewares = ["simpleAuth"]
service = "api@internal"
@Shogan
Shogan / traefik-le-staging-template.toml
Last active November 28, 2020 23:40
traefik-template.toml
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.web.http.redirections.entryPoint]
to = "websecure"
scheme = "https"
[entryPoints.websecure]
address = ":443"
BUCKET=your-backup-bucket-name-here
REGION=eu-west-2
aws iam create-user --user-name velero
cat > velero-policy.json <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
@Shogan
Shogan / codebuild_build.sh
Created June 21, 2020 19:20
AWS CodeBuild local docker build launch and configure
#!/bin/bash
function allOSRealPath() {
if isOSWindows
then
path=""
case $1 in
.* ) path="$PWD/${1#./}" ;;
/* ) path="$1" ;;
* ) path="/$1" ;;
@Shogan
Shogan / install-k8s-pi-components.sh
Created December 8, 2019 10:09
install kubernetes components for rpi
sudo tee /etc/apt/sources.list.d/kubernetes.list &>/dev/null <<EOF
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo apt-get update
# Pin / install specific versions of the following components
sudo apt-get install -qy kubelet=1.16.2-00 kubectl=1.16.2-00 kubeadm=1.16.2-00 kubernetes-cni=0.7.5-00
@Shogan
Shogan / metallb.yaml
Created December 7, 2019 22:41
MetalLB kubernetes resources manifest for raspberry pi cluster
apiVersion: v1
kind: Namespace
metadata:
labels:
app: metallb
name: metallb-system
---
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata: