Skip to content

Instantly share code, notes, and snippets.

using UnityEngine;
using System.Collections;
using PixelSpriteGenerator;
public class RandomShrub : MonoBehaviour {
private PsgMask mask;
private PsgSprite sprite;
private SpriteRenderer sr;
@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 / dnsmasq.conf
Created November 17, 2019 22:36
Creates a dnsmasq.conf configuration file
sudo tee /etc/dnsmasq.conf &>/dev/null <<EOF
# Our DHCP service will be providing addresses over our eth0 adapter
interface=eth0
# We will listen on the static IP address we declared earlier
listen-address=10.0.0.1
# Pre-allocate a bunch of IPs on the 10.0.0.0/8 network for the Raspberry Pi nodes
# DHCP will allocate these for 12 hour leases, but will always assign the same IPs to the same Raspberry Pi
# devices, as you'll populate the MAC addresses below with those of your actual Pi ethernet interfaces
@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 / 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 / tcpdump-cmds.md
Last active May 10, 2021 17:09
tcpdump useful commands

Some useful tcpdump commands

Listen on all interfaces (any) for traffic on port 8080:

tcpdump -vv -x -X -i any 'port 8080'

Listen on eth0 interface for all traffic:

tcpdump -vv -x -X -i eth0

@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"
@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 / 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"
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": [
{