Skip to content

Instantly share code, notes, and snippets.

View thewhodidthis's full-sized avatar
🔘

Sotiri Bakagiannis thewhodidthis

🔘
View GitHub Profile
@thewhodidthis
thewhodidthis / cmd
Last active April 7, 2025 03:35
Helps detect duplicate bookmark and reading list entries on Safari
plutil -convert xml1 -o - ~/Library/Safari/Bookmarks.plist | xmllint --xpath '//key[.="URLString"]/following-sibling::string[1]/text()' - | tr ' ' '\n' | sort | uniq -d
@thewhodidthis
thewhodidthis / AppDelegate.swift
Created April 1, 2025 08:16
Helps disable Mac keyboards by eating up key presses
import Cocoa
@main
class AppDelegate: NSObject, NSApplicationDelegate {
var eventTap: CFMachPort?
func applicationDidFinishLaunching(_ aNotification: Notification) {
let eventMask = (1 << CGEventType.keyDown.rawValue) | (1 << CGEventType.keyUp.rawValue)
@thewhodidthis
thewhodidthis / proxy.pac
Last active December 24, 2024 18:20
Helps locally route .pi4 requests
// https://gist.githubusercontent.com/thewhodidthis/4f5bf2f37f4870b9235642b48827c893/raw/proxy.pac
function FindProxyForURL(url, host) {
if (shExpMatch(host, "*.pi4")) {
return "PROXY 192.168.1.227"
}
return "DIRECT"
}
@thewhodidthis
thewhodidthis / Makefile
Last active June 13, 2024 11:26
PPM byte beat maker
# The filenaming timestamp
D?=$$(date +"%Y%m%d%s")
# Step
S?=2
# Pixmap dimensions
W?=192
H?=192
# How many pixels minus one
Q?=$$(($W * $H - 1))
# How many steps minus one
@thewhodidthis
thewhodidthis / Makefile
Last active September 4, 2023 15:33
FMU MP3 episode download, edit, and archive
YEAR?=$$(date +%Y)
UUID?=$$(python -c "import uuid; print(uuid.uuid4())")
ITEM?=justmoreidlechatternot
BOOM?=$(notdir $(CURDIR))
SHOW?=WA
NAME?=$$(date +%Y%m%d%s)
run: get cut mp3 put
@rm -rf episode.mp3 *.wav
put:
@thewhodidthis
thewhodidthis / Makefile
Last active May 28, 2023 20:28
Worley noise maker
# The filenaming timestamp
D?=$$(date +"%Y%m%d%s")
# How many feature points?
R?=10
# Pixmap dimensions
W?=80
H?=45
# How many pixels?
S?=$$(($W * $H - 1))
# Out image dimensions
@thewhodidthis
thewhodidthis / Makefile
Last active May 17, 2023 19:11
Extremely random pixel sorted image maker
# The filenaming timestamp
D?=$$(date +"%Y%m%d%s")
# Pix or bitmap dimensions
W?=80
H?=45
# How many numbers total?
S?=$$(bc <<< "3 * $W * $H")
# How many samples?
G?=$$(bc <<< "3 * $H")
# Out image dimensions
build:
@mkdir $$(date +"%Y%m%d%s"); cd $$_; echo "$$(date +"%Y%m%d%s")" > index.html; zip ../"$$(date +"%Y%m%d%s")".zip -r .
@thewhodidthis
thewhodidthis / main.js
Created December 6, 2022 09:32
Common hashing algorithms in JS
export function crc32c(data, n = data.length, poly = 0xEDB88320) {
let crc = 0xFFFFFFFF
for (let i = 0; i < n; i += 1) {
crc = crc ^ data.charCodeAt(i)
for (let j = 0; j < 8; j += 1) {
crc = crc & 1 ? (crc >>> 1) ^ poly : crc >>> 1
}
}
@thewhodidthis
thewhodidthis / snippet.sh
Created February 15, 2022 04:54
Retouch image files to reflect EXIF dates
find ./*.jpg -exec sh -c 'touch -d $$(date -j -f "%Y:%m:%d %H:%M:%S" "$$(identify -format "%[EXIF:DateTimeOriginal]" {})" +%Y-%m-%dT%H:%M:%S) {}' \;