Skip to content

Instantly share code, notes, and snippets.

View idiomatic's full-sized avatar

Brian Harrison idiomatic

  • Portland, Oregon
View GitHub Profile
@idiomatic
idiomatic / prefix.scpt
Created May 14, 2022 06:13
AppleScript to remove artist prefix from track name
tell application "Music"
repeat with trk in selection
set oldName to name of trk
set prefix to (artist of trk) & " - "
if oldName starts with prefix then
set len to length of oldName
set newName to (get characters (get length of prefix) thru len of oldName as string)
set name of trk to newName
end if
end repeat
console.image = function(url, scale) {
scale = scale || 1;
var img = new Image();
img.onload = function() {
const width = this.width * scale;
const height = this.height * scale;
console.log("%c+", `font-size:1px; padding:${Math.floor(height/2)}px ${Math.floor(width/2)}px; line-height:${height}px; background: url(${url}); background-size:${width}px ${height}px; color: transparent;`);
};
img.src = url;
};
(setopt null_glob;
for collection in \
"Very Fast 720p30 --subtitle=none" \
"HQ 720p30 Surround --subtitle=none" \
"Very Fast 480p30 --encoder=x265_10bit --subtitle=none" \
"HQ 1080p30 Surround --encoder=x265_10bit --subtitle=none"; do
preset=${collection%% --*} hbargs=${collection#$preset }
dest=(/Volumes/galactica/Public/Video/*/"$collection"{,/*})
src=(/Volumes/Nostromo/Rip/Blu*Rip{,/*} /Volumes/Archive*/Video/*/Blu*Rip{,/*})
[[ "$preset" != "*1080*" ]] && src=($src /Volumes/Nostromo/Rip/DVD*Rip /Volumes/Archive*/Video/*/DVD*Rip)
@idiomatic
idiomatic / README.md
Last active December 16, 2020 01:59
Example trivial directory-listing webservers

Directory-listing webserver comparison.

Directory

webserver dotdot? dotfiles? extra links? href " href & text "
Apache2 inline no sort-by, in <tr><th> %22 &amp; &quot;
Caddy header yes sort-by, in <thead><tr><th> %22 &amp; &#34;
Go no yes no %22 & &#34;
Lighttpd inline no no %22 %26 &#x22;
We couldn’t find that file to show.
@idiomatic
idiomatic / .bash_profile
Last active March 15, 2019 23:09
my dotfiles
export HISTFILESIZE=10000
export SAVEHIST=10000
if [ -e $HOME/bin ]
then
export PATH=$PATH:$HOME/bin
fi
if which -s node
then
@idiomatic
idiomatic / RULES.md
Last active November 21, 2018 21:36

Vanilla "Project 60" Rules

Races

Only races that were available in Vanilla.

No Pandaren [else warning].

No Worgen [else warning].

Legacy Node.js

const http = require('http');
const https = require('https');
const http2 = require('http2');
const s = http.createServer((req, res) => { });
s.listen(PORT, ADDRESS);
const options = {key: KEY, cert: CERT};
const stls = https.createServer(options, (req, res) => { });
@idiomatic
idiomatic / farmables.sql
Last active December 6, 2017 18:50
find things to farm in a classic WoW db, that drop "medium rarely" from few world mob types with longer average spawn durations
SELECT item.*,
CAST(oclt.ChanceOrQuestChance AS DECIMAL(6, 2)) as Chance,
COUNT(*) AS Spawns,
oct.entry as Creature,
oct.Name as `Creature Name`,
CAST(AVG(oc.SpawnTimeSecs) AS DECIMAL(6, 0)) AS `Spawn Time`
FROM (
SELECT i.*, COUNT(*) AS `Creature Types`
FROM (
SELECT iclt.item AS Item,
@idiomatic
idiomatic / islands.js
Last active December 6, 2017 20:53
count the number of "islands" in an matrix of non-wraparound bits, where horizontally/vertically/diagonally adjacent bits are the same island
const tests = [
[0, [[0]]],
[1, [[1]]],
[1, [[1, 0], [0, 0]]],
[1, [[0, 1], [0, 0]]],
[1, [[0, 0], [1, 0]]],
[1, [[0, 0], [0, 1]]],
[1, [[1, 0], [0, 1]]],
[1, [[0, 1], [0, 1]]],
[1, [[1, 0], [1, 0]]],