Skip to content

Instantly share code, notes, and snippets.

View idiomatic's full-sized avatar

Brian Harrison idiomatic

  • Portland, Oregon
View GitHub Profile

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 / 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].

@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
We couldn’t find that file to show.
@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;
(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)
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;
};
@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