Skip to content

Instantly share code, notes, and snippets.

View gingerbeardman's full-sized avatar

Matt Sephton gingerbeardman

View GitHub Profile
CHIP SHOT: SUPER PRO GOLF
(c)1987 INTV CORP.
DR: 240-300 YARDS
3W: 220-260
1I: 210-220
2I: 200-210
3I: 190-200
4I: 180-190
5I: 170-180
@gingerbeardman
gingerbeardman / convert2unicode.tcl
Last active April 12, 2024 20:04
Convert legacy text encodings to Unicode (UTF-8)
#!/opt/local/bin/port-tclsh
set ver {2021.12.02}
set author {Matt Sephton @gingerbeardman}
package require cmdline
set parameters {
{encoding.arg macJapan "source encoding, default:"}
{list "list encodings"}
@gingerbeardman
gingerbeardman / cat.sh
Last active December 2, 2021 15:27
Shell script to generate directory listings of old HFS CD-ROMs using my fork of hfsutils/hls and my convert2unicode.tcl script
#!/usr/bin/env zsh
autoload colors; colors
cd "~/Documents/CD-ROMs"
rm *.txt
catalogue() {
while read -r iso; do
directory=$(dirname "$iso")
@gingerbeardman
gingerbeardman / extract-and-bake-order.sh
Last active May 24, 2022 11:07
Extract a zip and bake original sort order as Finder comments and last modified date
#!/bin/bash
# by Matt Sephton @gingerbeardman
# dependencies: p7zip, pipx, osxmetadata
# $ brew install p7zip
# $ brew install pipx
# $ pipx install osxmetadata
# check your PATH and confirm operation
@gingerbeardman
gingerbeardman / remux.sh
Last active January 25, 2026 17:16
Synology DSM Task Scheduler custom script to remux any mkv files as mp4, moving old files to Recycle Bin
#!/usr/bin/env bash
# by Matt Sephton @gingerbeardman
# requires SynoCommunity ffmpeg to be installed
log="/volume1/video/Scripts/remux.log"
bin="/volume1/video/#recycle/"
work="/volume1/video/Scripts/"
export log
@gingerbeardman
gingerbeardman / faststart.sh
Last active June 28, 2023 06:33
Synology DSM Task Scheduler custom script to set faststart movflag on all mp4 files
#!/usr/bin/env bash
# by Matt Sephton @gingerbeardman
# requires SynoCommunity ffmpeg to be installed
log="/volume1/video/Scripts/faststart.log"
work="/volume1/video/Scripts/"
start="../"
export log
@gingerbeardman
gingerbeardman / hoyoyo.js
Last active January 30, 2022 15:27
PAC to route some content used by world.hoyoyo.com through secure HTTPS proxy to increase loading speed
function FindProxyForURL(url, host) {
// send hoyoyo requests to the proxy
if (shExpMatch(host, "*.hoyoyo.com|*.hoyoyo-cache.com")) return "PROXY 12.34.56.78:90";
// leave all other accesses untouched
return "DIRECT";
}
@gingerbeardman
gingerbeardman / import_bookmarks.php
Last active February 23, 2022 21:36
import browser bookmarks.html FAST using a regex with optional named groups
// href and title are required
// everything else is an optional named group, using format \s*(ATTR="(?P<attr>.*?)")?
$pattern = '|<DT><A HREF="(?P<href>.*?)"\s*(ADD_DATE="(?P<add_date>.*?)")?\s*(LAST_MODIFIED="(?P<last_modified>.*?)")?\s*(ICON_URI="(?P<icon_uri>.*?)")?\s*(ICON="(?P<icon>.*?)")?\s*(PRIVATE="(?P<private>.*?)")?\s*(TOREAD="(?P<toread>.*?)")?\s*(TAGS="(?P<tags>.*?)")?>(.*?)</A>|';
$string = file_get_contents("bookmarks.html");
preg_match_all($pattern, $string, $matches, PREG_PATTERN_ORDER); // all pattern matches get their own sub-array
$array_filtered = array_filter($matches, "is_string", ARRAY_FILTER_USE_KEY); // keep only named arrays (our groups)
echo count($array_filtered[href]); // show count
@gingerbeardman
gingerbeardman / page.auctions.yahoo.co.jp.css
Last active April 7, 2022 16:02
dot files for Safari extension "PageExtender" to redirect Yahoo! Japan Auctions item pages to an equivalent of your choice
* {
display: none !important;
}
@gingerbeardman
gingerbeardman / pac-yahoo-japan.js
Last active April 17, 2022 20:11
Example PAC file to route only access to Yahoo! Japan for the website and app
function FindProxyForURL(url, host) {
if (
dnsDomainIs(host, "storage-yahoo.jp") ||
dnsDomainIs(host, "yahooapis.jp") ||
dnsDomainIs(host, "yimg.jp") ||
dnsDomainIs(host, "yahoo.co.jp")
) return "PROXY 12.34.56.78:8888";
return "DIRECT";
}