Skip to content

Instantly share code, notes, and snippets.

@Shogan
Shogan / RIPPLES.BAS
Last active Feb 23, 2022
A simple, retro screensaver written in QBasic
View RIPPLES.BAS
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 Sep 3, 2021
convert aisatana MIDI notes to 32 x phrases as alda compatible strings
View quantize.js
// the Aisatana track MIDI notes
const notes = [
{
"name": "E3",
"midi": 52,
"time": 0,
"velocity": 0.30708661417322836,
"duration": 0.5882355
},
{
@Shogan
Shogan / run.sh
Created Nov 25, 2020
docker-compose as a docker container on any arch, including ARM
View run.sh
#!/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 Aug 28, 2021
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.
View docker-compose.yml
version: "3"
networks:
web:
external: true
internal:
external: false
services:
blog:
@Shogan
Shogan / example-traefik-dynamic.toml
Created Nov 21, 2020
an example of a traefik dynamic toml configuration
View example-traefik-dynamic.toml
[http.middlewares.simpleAuth.basicAuth]
users = [
"YourUsername:$apr1$bJDZ0TQm$IBSNb2xcRsYrIdcJxNG1h."
]
[http.routers.api]
rule = "Host(`dashboard.example.com`)"
entrypoints = ["websecure"]
middlewares = ["simpleAuth"]
service = "api@internal"
View traefik-le-staging-template.toml
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.web.http.redirections.entryPoint]
to = "websecure"
scheme = "https"
[entryPoints.websecure]
address = ":443"
View velero-aws-s3-prereqs.sh
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 Jun 21, 2020
AWS CodeBuild local docker build launch and configure
View codebuild_build.sh
#!/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 Dec 8, 2019
install kubernetes components for rpi
View install-k8s-pi-components.sh
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 Dec 7, 2019
MetalLB kubernetes resources manifest for raspberry pi cluster
View metallb.yaml
apiVersion: v1
kind: Namespace
metadata:
labels:
app: metallb
name: metallb-system
---
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata: