Skip to content

Instantly share code, notes, and snippets.

View gingerbeardman's full-sized avatar

Matt Sephton gingerbeardman

View GitHub Profile
@gingerbeardman
gingerbeardman / volumes.60s.sh
Last active February 25, 2025 13:51
xbar/bitbar shell script to list and clean and eject (unmount using option) volumes as a replacement for CleanMyDrive
#!/bin/zsh
# <bitbar.title>Volume Manager</bitbar.title>
# <bitbar.version>250225</bitbar.version>
# <bitbar.author>Matt Sephton</bitbar.author>
# <bitbar.author.github>gingerbeardman</bitbar.author.github>
# <bitbar.desc>Lists and manages mounted user volumes</bitbar.desc>
# <bitbar.dependencies>zsh</bitbar.dependencies>
# <bitbar.abouturl>https://gist.github.com/gingerbeardman/610f22180117ad20465d7c529cc5faa0</bitbar.abouturl>
setopt EXTENDED_GLOB
@gingerbeardman
gingerbeardman / jp2pdf.sh
Created February 3, 2025 21:26
Convert folder full of jp2 images into PDF, parallel across 8 CPU cores
find . -name "*.jp2" | parallel -j 8 sips -s format pdf -s formatOptions 75 --resampleHeight 1536 {} --out ../pdf/{.}.pdf
@gingerbeardman
gingerbeardman / cone.scad
Last active January 12, 2025 07:40
Traffic cone with shadow in OpenSCAD
// Animation settings
$vpr = [45,0,-90];
$vpt = [0,0,05];
$vpd = 250;
// Colors
shade = [0.5,0.5,0.45,1];
orange = [1.0,0.5,0.0,1];
black = [0.2,0.2,0.2,1];
white = [0.9,0.9,0.9,1];
@gingerbeardman
gingerbeardman / access_control.sh
Created January 7, 2025 20:21
Access control and permissions
#!/bin/bash
# Create the directory if it doesn't exist
sudo mkdir -p /var/log/caddy
# Set ownership to caddy user and group
sudo chown caddy:caddy /var/log/caddy
# Set appropriate permissions (755 for directory)
sudo chmod 755 /var/log/caddy
@gingerbeardman
gingerbeardman / git-pull-watcher.service
Last active January 7, 2025 16:20
Git Pull watcher service, /etc/systemd/system/git-pull-watcher.service
[Unit]
Description=Git Pull Watcher Service
After=caddy.service
StartLimitIntervalSec=0
[Service]
Type=simple
ExecStart=/opt/webserver/git_pull_watcher.sh
Restart=always
RestartSec=1
@gingerbeardman
gingerbeardman / git_pull_watcher.sh
Last active January 7, 2025 19:30
Webhook git pull watcher Shell script
#!/bin/bash
TRIGGER_FILE="/var/www/example.com/triggers/git_pull_trigger"
LOG_FILE="/var/log/git_pull_watcher.log"
REPO_PATH="/var/www/example.com"
log() {
echo "$(date): $1" >> "$LOG_FILE"
}
@gingerbeardman
gingerbeardman / webhook.php
Last active February 10, 2025 23:11
Webhook receiver PHP script
<?php
// GitHub webhook secret (set this in your GitHub webhook settings)
$secret = "Y0UR-secret-text-here!";
// Get the payload
$payload = file_get_contents('php://input');
// Verify the signature
$signature = $_SERVER['HTTP_X_HUB_SIGNATURE'] ?? null;
@gingerbeardman
gingerbeardman / lite_yt_embed.rb
Last active January 4, 2025 19:35
jekyll plugin to enable better youtube embeds with lite-yt-embed
module Jekyll
class YouTubeEmbed < Liquid::Tag
def initialize(tag_name, input, tokens)
super
@input = input.strip
end
def render(context)
parts = @input.split(' ')
@gingerbeardman
gingerbeardman / DSSPlayer.txt
Last active January 4, 2025 19:36
DSS Player version 7 software serial number for OM/Olympus DS-30 DS-40 DS-50 Digital Voice Recorder
8360-0101-0044-4084-1936
@gingerbeardman
gingerbeardman / cdn_img.rb
Last active August 19, 2024 17:22
transform local image paths to use your own CDN server
# file: _plugins/cdn_img.rb
module Jekyll
class CDNImageTransformer < Generator
def generate(site)
@site = site
@cdn_url = "https://cdn.example.com"
@site.pages.each { |page| process(page) }
@site.posts.docs.each { |post| process(post) }
end