Skip to content

Instantly share code, notes, and snippets.

View donaldguy's full-sized avatar
💊
recently relapsing on software as apparent side-effect of psychiatric medication

Donald Guy donaldguy

💊
recently relapsing on software as apparent side-effect of psychiatric medication
View GitHub Profile
@donaldguy
donaldguy / shell_vars_from_json.jq
Last active June 8, 2024 03:50
Have you ever had a json object or array and wished it was a serious of zsh/bash variables? … yeah ¬_¬ , totally, me neither 😅 https://jqplay.org/s/biOH4MLXDfe
def declare: (
.t as $type | .var as $var |
{"array": "-a", "object": "-A"}[$type] as $arg |
"declare \($arg) \($var);"
);
def shellify: (
. as $container |
@donaldguy
donaldguy / com.surteesstudios.Bartender.plist
Last active September 25, 2024 05:11
Bartender 5.1.8 nicely formatted and ordered plist (also xml instead of binary obvs; but it'll happily read/convert it after `cp $this ~/Library/Preferences/com.surteesstudios.Bartender.plist`)
<?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>
<!-- General: -->
<!-- when set to default values these settings removed from the plist -->
<!-- "Show hidden menu bar items when:" -->
<key>ClickingMenuBarTogglesBartender</key> <integer>1</integer>
<key>ScrollingMenuBarShowsHiddenItems</key> <integer>1</integer>
<key>MouseOverMenuBarTogglesBartender</key> <integer>1</integer>
@donaldguy
donaldguy / ApplicationGroup_JXA.js
Created January 31, 2025 06:11
JXA sh template and group name fetch - I ended up throwing these away (and just globbing-ish in ~/Library/Group Containers)
let sh = (strs, ...subs) => {
const q = (s) => `${s}`.match(/^['"].*['"]$/) ? `${s}` : `'${s}'`
return app.doShellScript(
strs.flatMap((s,i) => subs[i] ? [s.trim(), q(subs[i])] : s.trim() ).join(" ")
)
}
let getAppGroup = (appName) => sh`codesign --display --entitlements - --xml 2> /dev/null
${Application("System Events").applicationProcesses[appName].applicationFile().posixPath()}