Skip to content

Instantly share code, notes, and snippets.

View RickyCook's full-sized avatar
🏳️‍🌈

Ricky Cook RickyCook

🏳️‍🌈
View GitHub Profile
@RickyCook
RickyCook / Caddyfile
Created July 7, 2026 15:56
Constrained local root CA for Caddy
{
pki {
ca local {
name "My Constrained Local CA"
root {
cert /etc/caddy/certs/root.crt
key /etc/caddy/certs/root.key
}
intermediate {
cert /etc/caddy/certs/intermediate.crt
@RickyCook
RickyCook / run_in_linux.sh
Created August 16, 2022 06:11
Wrap a command in a Docker container to create a simple "in Linux" utility
#!/usr/bin/env bash -e
### CONFIG
CONTAINER_NAME=something_unique_here
CONTAINER_IMAGE=python:3.9 # must have bash, or change the infinite sleep on :17
COMMAND_PREFIX=./pants
### STOP EDITING
@RickyCook
RickyCook / rules.txt
Created August 17, 2021 04:35
uMatrix rulesets
Shopify as 3rd-party
* shopifysvc.com
_ shopify.com frame
_ shopify.com script
_ shopifysvc.com other
#include <IRremote.h>
int IR_RCV_PIN = 2;
int IR_SND_PIN = 15;
int AMP_RCV_PIN = 36;
IRrecv irrecv(IR_RCV_PIN);
IRsend irsend;
@RickyCook
RickyCook / README.md
Created June 24, 2020 01:18
Slack Settings

Because Slack is shit

Sidebar

  • Sort by priority

Theme

  • Dark

Messages and Media

  • Compact
@RickyCook
RickyCook / _notes.md
Last active September 25, 2024 03:14
Quick bastion Wireguard VPN

Quick and dirty Wireguard bastion VPN

Enable IPv4 forwarding

sysctl -w net.ipv4.ip_forward=1 or echo 1 > /proc/sys/net/ipv4/ip_forward

/etc/sysctl.conf: net.ipv4.ip_forward = 1

Check IPv4 forwarding

@RickyCook
RickyCook / races.js
Created April 12, 2020 05:25
Random pairs generation
// sortedHashes = ['a', 'b', 'c', 'd', 'e', ...]
// doneRaces = [['a', 'c'], ['c', 'e'], ['a', 'b'], ...]
function getNewVoteRace(sortedHashes, doneRaces) {
let firstHash;
let secondIdxMax;
let secondTotalOpts;
let secondBlacklist;
while(_.isNil(secondIdxMax) || secondBlacklist.length >= secondTotalOpts) {
@RickyCook
RickyCook / auth_state_machine.js
Created April 1, 2020 10:08
Authentication state machine
const TIMEOUT_MS = 2000;
const FSM_DEF = {
id: 'tokenRequest',
initial: 'timing',
context: {
payload: { statusCode: 500, body: '{"error":"Unknown error [init]"}'},
},
states: {
timing: {
@RickyCook
RickyCook / codepipelinehack.py
Created February 7, 2020 00:10
CodePipeline hack to "support" symlinks
# CodePipeline doesn't support symlinks. They are reflected on
# disk as their target path in the file contents.
check_content_path = True
while check_content_path:
content = sql_path.read_text()
try:
new_sql_path = sql_path.parent.joinpath(content)
if new_sql_path.exists():
sql_path = new_sql_path
else:
@RickyCook
RickyCook / collar.py
Created August 25, 2019 04:33
Decode a messy binary sequence whose value is ASCII/UTF-8 and that's all you know
#!/usr/bin/env python3
import sys
from copy import deepcopy
from pprint import pprint
class Decoder(object):
def __init__(