Skip to content

Instantly share code, notes, and snippets.

View thewhodidthis's full-sized avatar
🔘

Sotiri Bakagiannis thewhodidthis

🔘
View GitHub Profile
@thewhodidthis
thewhodidthis / main.js
Last active April 12, 2026 20:44
Helps read EXIF GPS coordinates out of JPEG array buffers
// Got most of these from: exiftool.org/TagNames/EXIF.html
const EXIF = 0x45786966
const LITTLE_ENDIAN = 0x4949
const JPEG = 0xFFD8
// The IFD0 tag holding the GPS Image File Directory (IFD) offset.
const GPS_POINTER = 0x8825
// The JPEG segment marker where EXIF data is found.
const APP1 = 0xFFE1
@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 / Ivory.terminal
Last active May 4, 2024 05:00
Material flavored Terminal.app theme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlackColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS
AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGrCwwXGBkeHygwMThVJG51bGzV
DQ4PEBESExQVFlYkY2xhc3NbTlNDb2xvck5hbWVcTlNDb2xvclNwYWNlXU5TQ2F0YWxv
Z05hbWVXTlNDb2xvcoAKgAMQBoACgARWU3lzdGVtXxAndW5lbXBoYXNpemVkU2VsZWN0
@thewhodidthis
thewhodidthis / script
Last active May 4, 2024 04:57
Batch remove mp3 meta tags using ffmpeg
#!/bin/bash
for f in *.mp3; do
ffmpeg -i "$f" -map 0:a -codec:a copy -map_metadata -1 "${f%.*}-out.mp3"
done
@thewhodidthis
thewhodidthis / script.sh
Last active May 4, 2024 04:56
Turn mp4 video into animated gif using ffmpeg
#!/bin/sh
# Helps turn videos into gif loops
# Usage:
# ./gloop input.mp4 palette.png output.gif
# Reference:
# http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
# Shortcut
@thewhodidthis
thewhodidthis / script.sh
Last active May 4, 2024 04:56
Turn mp4 video into gif strip using ffmpeg and IM
#!/bin/sh
# Helps turn videos into gif strips
# Usage:
# ./gfilm input.mp4 output.gif
# Reference:
# https://imagemagick.org/script/montage.php
# Shortcut
@thewhodidthis
thewhodidthis / script.sh
Last active May 4, 2024 04:53
Generate iconset for png on macOS
#!/bin/sh
# Helps produce iconsets
# Usage:
# ./gicns input.png output.icns
# Reference:
# http://stackoverflow.com/questions/12306223/how-to-manually-create-icns-files-using-iconutil
# Shortcut