Skip to content

Instantly share code, notes, and snippets.

View caseyfw's full-sized avatar

Casey Fulton caseyfw

View GitHub Profile
version: "3.8"
services:
minecraft:
image: itzg/minecraft-server
ports:
- 25565:25565
restart: unless-stopped
environment:
EULA: "TRUE"
OPS: CaseyFulton
@caseyfw
caseyfw / config-dump.sh
Created July 23, 2019 04:27
Prodigy config dump shenans
#!/bin/bash
branch=$(git branch | grep \* | cut -d ' ' -f2)
[[ "roar" == "$branch" ]] || branch=fixed
# Delete output files.
rm build/config/${branch}/*
robo parameters:copy-from-dist-all
@caseyfw
caseyfw / conspiracy-santa.js
Created August 31, 2018 01:28
Conspiracy santa generator
const names = require("./names.json");
const numberOfConspirators = 4;
// Randomise names - comment out for repeatable results.
names.sort(function() {
return 0.5 - Math.random();
});
console.log(
JSON.stringify(
@caseyfw
caseyfw / reverse-ssh-tunnel.service
Created August 28, 2018 11:31
Reverse ssh tunnel systemd service
[Unit]
Description=Reverse SSH tunnel to scratch.
After=network-online.target
Before=multi-user.target
DefaultDependencies=no
[Service]
Restart=always
RestartSec=10
ExecStart=/usr/bin/ssh \
@caseyfw
caseyfw / ssl-expiry-check.sh
Created July 17, 2018 02:56
SSL certificate expiry checker - warns when a cert is expiring in less than 7 days.
#!/bin/bash
# Number of days from expiry to throw warning.
warnPeriod=7
domainsFile="$( cd "$(dirname "$0")" ; pwd -P )/domains.txt"
if [ ! -f "$domainsFile" ]; then
>&2 echo "Missing domains.txt file."
exit 1
@caseyfw
caseyfw / slack-me
Created July 12, 2018 00:10
Send slack message from shell script
#!/bin/bash
# Slack bot token to use for auth.
token=xoxb-1234567890-ABCDEFGHIJK1234567890
# Channel ID or user ID to post to.
channel=U12345678
# Name of bot user to post message as.
username=warnbot
# Emoji to use as icon for message.
emoji=":warning:"
@caseyfw
caseyfw / certbot-authenticator-zuver.sh
Created June 13, 2018 05:22
Letsencrypt certbot authenticator for Zuver domain registrar - supports wildcard certificates via the DNS challenge
#!/bin/sh
COOKIE_JAR=$(mktemp)
: ${CERTBOT_DOMAIN?"Missing CERTBOT_DOMAIN env var."}
: ${CERTBOT_VALIDATION?"Missing CERTBOT_VALIDATION env var."}
: ${ZUVER_EMAIL?"Missing ZUVER_EMAIL env var."}
: ${ZUVER_PASSWORD?"Missing ZUVER_PASSWORD env var."}
: ${ZUVER_DOMAIN_HASH?"Missing ZUVER_DOMAIN_HASH env var."}
DOMAIN_PREFIX="_acme-challenge"
@caseyfw
caseyfw / index.php
Created January 5, 2018 02:07
Fortify badge generator
<?php
$clientId = getenv('clientId') ?? $_GET['clientId'] ?? null;
$clientSecret = getenv('clientSecret') ?? $_GET['clientSecret'] ?? null;
if ($clientId === null || $clientSecret === null) {
error('auth failure', "Need clientId and clientSecret env vars or parameters.\n");
}
$releaseName = getenv('release') ?? $argv[1] ?? $_GET['r'] ?? $_GET['release'] ?? null;
if ($releaseName === null) {
@caseyfw
caseyfw / deproxify.sh
Last active March 5, 2021 08:29
Scripts to emulate the functionality of Proxifier in Linux by adding iptables rules to route redirect traffic via a transparent proxy.
#!/bin/bash
PORTS="22 80 443"
DEFAULT_DNS=$(nmcli device show $DEFAULT_INTERFACE | grep IP4\.DNS | awk '{print $2}' | head -n 1)
DEBUG=1
function debug {
if [ $DEBUG -eq 1 ]; then
echo $1
fi
@caseyfw
caseyfw / disable-proxy.sh
Last active December 10, 2017 23:36
Quick scripts to toggle the FC corporate proxy on an Ubuntu machine
#!/bin/bash
# Remove proxy config from system environment.
sed -r -i.old '/https?_proxy/d' /etc/environment
# Remove proxy config from APT.
sed -i.old '/proxy/d' /etc/apt/apt.conf
# Stop CNTLM.
systemctl stop cntlm.service