Skip to content

Instantly share code, notes, and snippets.

View vaughany's full-sized avatar
🎢
Operating from an interim headquarters

Paul Vaughan vaughany

🎢
Operating from an interim headquarters
View GitHub Profile
@vaughany
vaughany / reordering_linked-list.sql
Created November 17, 2023 17:03
SQL commands to reorder data based on a 'position' column
drop table if exists stuff;
create table if not exists stuff (
id bigserial primary key not null,
name character varying (10) not null,
position smallint not null default 0
);
create unique index if not exists name_idx on stuff (name asc);
create index if not exists position_idx on stuff (position asc);
@vaughany
vaughany / main.go
Created May 25, 2023 09:05
Minimum code required to use Go library 'essentialkaos/sslscan' to programatically scan a URL using Qualys SSL Labs.
package main
// Qualys' SSL Labs is a great tool for testing a URL's security: https://www.ssllabs.com/ssltest/
// They provide an API so you can test URLs programatically: https://www.ssllabs.com/projects/ssllabs-apis/
//
// Essential Kaos created and maintains a Go library to interface to the SSL Labs API: https://github.com/essentialkaos/sslscan
// There were no examples of use for the above library.
//
// Essential Kaos created and maintains a CLI application to scan URLs, which uses his library: https://github.com/essentialkaos/sslcli
//
@vaughany
vaughany / hdmi1
Created April 6, 2023 13:31
Changing the sound output on my Lenovo P15s from bash (https://askubuntu.com/a/14083/80418)
#!/bin/bash
# Put in /usr/local/bin/hdmi1 and chmod +x it. Run with 'hdmi1'.
pacmd set-default-sink "alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_3__sink"
@vaughany
vaughany / gist:11e27b5810ad227e26d223c5f7a39b53
Last active April 2, 2024 16:13
A little CLI app to display the time in some common timezones.
We couldn’t find that file to show.
@vaughany
vaughany / van-eck-sequence.go
Created December 16, 2020 13:37
Van Eck Sequence in Go.
// Van Eck Sequence
// Run with: `go run van-eck-sequence.go`
package main
import (
"flag"
"fmt"
"os"
@vaughany
vaughany / aoc-2020-d06.txt
Created December 7, 2020 11:43
Input for AoC 2020 day six
qzbw
qez
xgedfibnyuhqsrazlwtpocj
fxgpoqijdzybletckwaunsr
pwnqsizrfcbyljexgouatd
ljtperqsodghnufiycxwabz
uk
kupacjlriv
@vaughany
vaughany / test-ssh.sh
Created October 28, 2020 12:14
Tests the VPN's status by ssh-ing to an IP address only accessible when the VPN is up and running a basic command. Runs less frequently on success, very frequently on failure.
#!/bin/bash
shellcheck "$0" || exit 1
IP=1.2.3.4
OUT=test-ssh.log
DELAY_MIN=2
DELAY_MAX=128
DELAY=$DELAY_MIN
@vaughany
vaughany / create-csv.sh
Created July 27, 2020 08:03
Little bash script to create a CSV file containing many thousands of fake (but valid) URLs.
#!/bin/bash
# Each 'run' generates 10 unique URLs, so if RUNS=10 you'll get 100 lines out.
# Requires `gpw` to be installed, as a source for nice, random strings.
FILE=large-test.csv
RUNS=10000
if test -f "$FILE"; then
truncate -s 0 $FILE
@vaughany
vaughany / gist:84f2bcca49b3252683f6685d0cb9f0a6
Created May 3, 2020 10:05
Making circles of [block-type] in Minecraft 1.15
To use this command in Java 1.13, do this for the first command block:
`/execute if entity @e[type=minecraft:armor_stand, name=CircleStand] at @e[type=minecraft:armor_stand, name=CircleStand] run tp @e[type=minecraft:armor_stand, name=CircleStand] ~ ~ ~ ~1 ~`
Set to *repeating*.
And for the second command block, do this:
`execute at @e[type=armor_stand, name=CircleStand] run setblock ^ ^ ^10 gold_block`
@vaughany
vaughany / frontail.md
Created March 19, 2020 15:34
Install and run Frontail manually on Ubuntu

Frontail

On server to be Frontail-ed:

Download frontail from https://github.com/mthenw/frontail:

$ wget https://github.com/mthenw/frontail/releases/download/v4.9.0/frontail-linux

Move to /usr/local/bin/: