Skip to content

Instantly share code, notes, and snippets.

View andrew-stclair's full-sized avatar

Andrew St Clair andrew-stclair

View GitHub Profile

RTTTL Ringtones

Sea Shanty 2

Sea Shanty 2: d=16,o=5,b=100: 16a, 16p, 16e, 16d, 8c#, 16p, 16c#, 16d, 16e, 16f#, 16g#, 8e, 8p, 16f#, 16p, 16e, 16d, 16c#, 16p, 16c#, 16p, 16b4, 16p, 16c#, 16p, 8d, p

@andrew-stclair
andrew-stclair / test_random.py
Last active August 10, 2023 06:46
WIP Python Script to check the random devices
"""Randomness Validator"""
# How many bytes to read
BYTES_READ = 50000000
# Devices to check
DEVICES = [
"/dev/random",
"/dev/urandom"
]

Automating Ubuntu Pro

I dont garantee these will always work, nor are they a good way of achieving some level of automation for ubuntu pro, but they worked at time of writing.

Run commands when ubuntu pro is activated

Checks if the output of the pro status command contains the string "Valid until"

# If Ubuntu Pro is Activated
@andrew-stclair
andrew-stclair / README.md
Last active March 31, 2023 05:09
LUKS Encrypted Disks scripts

LUKS Encrypted disks scripts

The following are scripts that can help with the use of LUKS encrypted disks, though they are very rudementry and require sudo.

The onlt script you will need is the crypt-format script, it's what creates the encrypted partition or file, the others just mount and unmount, which gnome can do on it's own (Other might be able to as well, but i have tested gnome)

Usage

Optional: Create mountable image

@andrew-stclair
andrew-stclair / gpg-ssh-auth.md
Last active February 28, 2023 23:34
Use a GPG key for SSH authentication

Use a GPG key for SSH authentication

These steps have been tested on MacOS. Linux should be similar if not the same. Good luck on Windows

Why would i do this?

  • If you are already using a GPG key to sign git commits or packages, it's one less key to securely backup.
  • GPG keys can be stored on OpenPGP Smart Cards like the YubiKey

Create a GPG key

@andrew-stclair
andrew-stclair / prompt.py
Last active October 31, 2022 04:17
Python Prompt - An example of a prompt like program in python, this does not use the match function from Python 3.10
# Variables
storage = {
'prompt': "❯",
'username': "root",
'hostname': "ubuntu"
}
# Default 'command not found' command
def h_noop(_):
@andrew-stclair
andrew-stclair / ShellShort.md
Last active January 10, 2023 00:20
Shell short hand

Bash short hand

systemctl start service-{a,b}.service would be equivalent to systemctl start service-a.service service-b.service

systemctl start srv-{1..4}.service would be equivalent to systemctl start srv-1.service srv-2.service srv-3.service srv-4.service

If for example you had multiple wireguard services and wanted to enable both the service and path for each

systemctl enable wg{0..3}.{service,path} would be equivalent to systemctl enable wg0.service wg0.path wg1.service etc...

UI in docker container

docker-compose.yml

version: "3"

services:
  wg:
    image: ngoduykhanh/wireguard-ui:latest
    container_name: wgui
    cap_add:
@andrew-stclair
andrew-stclair / valheim.service
Created September 11, 2021 08:45 — forked from nerdstrom/valheim.service
Valheim dedicated server systemd unit file
# make sure to adjust ALL paths and user/group in the service file (also the ones under "Security and Sandboxing")
[Unit]
Description=Valheim dedicated server
Wants=network-online.target
After=syslog.target network.target nss-lookup.target network-online.target
[Service]
Environment="LD_LIBRARY_PATH=/home/steam/servers/valheim/linux64"
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBGACyMoBEADK9NiIa4Iku4su57WtNuAzkYSqsr+vDDc7xp5jSopB1f37SMUv
B9bqCbPkbisDIouM1ZDGGeDhMK+Ja0AWy6ZF161XeYyHnhZK4WBZ1luyTjA7rYr6
E1jpEEn3LIQZD9unQ9FLXWIBZL3MpsP1lgPg3tmmarxWKef+nWFBZRpwvSL0tQna
6Kwer/btOgh2L/4abaZds4Zcl8nIWGGqfJvTcPwbQ4FNvj04lkc51hlqCAGTiawg
TKTHd0eph+g+7XaMcwg+4nmRu0U2zpTjfOSpqB4nmv/q2hOLlDze9Xh+SVGhXXPJ
kKcwbnUMzF4PX4dO/oDvte2dk5/QnXSxL1pnzWE3PxBl24j/4AS/lJphGaim+xU9
QdPboXukjOjGGq6B3saG/0s7nXoxbdtQcuQQjR+pSzQrb449npbpYu7T8TndG+Kx
iQYJetDn+RWiPA3hUXJ/Xaa8x8eYw9bdMAo+QprifWB+lm2ddi1BJl6SZ0Gnd+iL