Skip to content

Instantly share code, notes, and snippets.

View gingerbeardman's full-sized avatar

Matt Sephton gingerbeardman

View GitHub Profile
local gfx <const> = playdate.graphics
local W <const> = playdate.display.getWidth()
local H <const> = playdate.display.getHeight()
local BAND_HEIGHT <const> = 6 --band size
function playdate.update()
for band=0,8 do --create gradient using multiple bands
gfx.setDitherPattern(1-1/(band+1), gfx.image.kDitherTypeBayer8x8) --dither amount
@gingerbeardman
gingerbeardman / feeds.opml
Created June 29, 2023 20:27
RSS feeds OPML
<?xml version="1.0" encoding="UTF-8"?>
<opml xmlns:frss="https://freshrss.org/opml" version="2.0">
<head>
<title>FreshRSS</title>
<dateCreated>Thu, 29 Jun 2023 21:15:11 +0100</dateCreated>
</head>
<body>
<outline text="Computers">
<outline text="32by32" type="rss" xmlUrl="https://32by32.com/feed/" htmlUrl="https://32by32.com/" description="Macintosh History from the 1980s"/>
<outline text="Accidentally in Code" type="rss" xmlUrl="https://cate.blog/feed/" htmlUrl="https://cate.blog" description="Engineering an Interesting Life"/>
@gingerbeardman
gingerbeardman / Linkding.postman_collection.json
Created May 20, 2023 11:50
Linkding collection for Postman
{
"info": {
"_postman_id": "356eda77-071b-42db-97f1-53f297f4cf4d",
"name": "Linkding",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "26329767"
},
"item": [
{
"name": "AUTH",
@gingerbeardman
gingerbeardman / uri.sh
Created May 1, 2023 16:29
Convert a file to data-uri
#!/usr/bin/env bash
echo "url('data:$(file -bN --mime-type "$1");base64,$(base64 < "$1")')"
@gingerbeardman
gingerbeardman / polyglot.css
Last active March 28, 2023 19:03
Quick fix for WebKit change that breaks Polyglot Safari Extension popup, put in your user stylesheet
div#polyglot__panel {
transform: scale(1) !important;
}
@gingerbeardman
gingerbeardman / pair-wii-remote-macos.sh
Last active October 23, 2023 23:37
Automatically pair a Wii Remote to macOS using blueutil command-line tool (Intel-only? fails on Apple silicon)
#!/usr/bin/env bash
# requirements: blueutil
echo "Hold both 1+2 buttons on Wii Remote and wait for 30 seconds"
# get MAC Address of Wii Remote
MAC=`$(which blueutil) --inquiry 5 2>&1 | grep 'address' | awk '{print substr($2,1,17)}'`
(killall -m 'blueutil*' 2>&1) >/dev/null
echo "MAC: $MAC"
@gingerbeardman
gingerbeardman / jog.sh
Last active February 28, 2023 19:41
Sony USB Jog Controller (PCVA-JC1)
#!/usr/bin/env zsh
# requirements: hidapitester, sendkeys
doPress() {
cur+="$1"
sendkeys send --delay 0 --initial-delay 0 -c "$1" # faster than osascript
}
hidapitester --vidpid 054C/00C4 -l 4 --open --read-input-forever --quiet \
var g=null,i,j=this;function aa(){}
function k(a){var b=typeof a;if(b=="object")if(a){if(a instanceof Array)return"array";else if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if(c=="[object Window]")return"object";if(c=="[object Array]"||typeof a.length=="number"&&typeof a.splice!="undefined"&&typeof a.propertyIsEnumerable!="undefined"&&!a.propertyIsEnumerable("splice"))return"array";if(c=="[object Function]"||typeof a.call!="undefined"&&typeof a.propertyIsEnumerable!="undefined"&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
else if(b=="function"&&typeof a.call=="undefined")return"object";return b}function l(a){return k(a)=="array"}function m(a){var b=k(a);return b=="array"||b=="object"&&typeof a.length=="number"}function n(a){return typeof a=="string"}function ba(a){a=k(a);return a=="object"||a=="array"||a=="function"}Math.floor(Math.random()*2147483648).toString(36);function ca(a){return a.call.apply(a.bind,arguments)}
function da(a,b){if(!a)throw Error();if(ar
@gingerbeardman
gingerbeardman / repack.sh
Created December 11, 2022 14:11
repack Becker Cascade Traffic Pro navigation filesystem
#!/usr/bin/env zsh
# repack Becker Cascade Traffic Pro navigation filesystem
# requires: 7zip
echo "merging RAW files into source ISO"
rm -rf NEW
mkdir NEW
cat TRACK01.RAW TRACK02.RAW > NEW/RAW.ISO
@gingerbeardman
gingerbeardman / gif-opt-2x.sh
Last active May 5, 2022 15:30
Scale a GIF @2x and Optimise using gifsicle
FILE=`basename "$@" .gif`
PARENT=`dirname "$@"`
/usr/local/bin/gifsicle -O1 -Okeep-empty --careful --scale 2 "$@" > "$PARENT/$FILE.opt.gif"