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 / 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()}
@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 / 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 / version_endpoints_compare.sh
Created May 28, 2024 00:26
some pretty stupid roundabout bash
# cross-platform bash-3.2 compatible (thanks macos)
#
# examples:
#
# $ version_endpoints_compare "3.7.1" "<=4.3.1" "=4.3.4" ">=4.3.5" ">=4.4"
# <=4.3.1
# $ version_endpoints_compare "4.3.1" "<=4.3.1" "=4.3.4" ">=4.3.5" ">=4.4"
# <=4.3.1
# $ version_endpoints_compare "4.3.2" "<=4.3.1" "=4.3.4" ">=4.3.5" ">=4.4"
# other
@donaldguy
donaldguy / 0-eth0.network
Last active April 3, 2024 19:59
kubeadm stuff
[Match]
MACAddress=62:55:1b:5f:f7:d6
[Network]
IPForward=yes
DNS=9.9.9.9
Address=10.0.0.1/12
Gateway=10.15.0.1
[Route]
@donaldguy
donaldguy / bootstrap_podman_machine.sh
Last active February 1, 2024 06:56
boot messages during `podman machine start` (qemu)
#!/bin/bash
set -o errexit -o nounset -o pipefail
bootstrap_podman() {
if ! podman system info &>/dev/null; then
echo "!!podman not initialized: doing that" >&2
if ! podman machine inspect &>/dev/null; then
podman machine init --user-mode-networking
@donaldguy
donaldguy / userscript-app_hey_com-unread_and_autoadvance.js
Last active September 12, 2024 03:47
app.hey.com: add unread counts and auto-advance to the "Imbox" - very much a work in progress
// ==UserScript==
// @name Add counts to Hey.com Imbox (and contents)
// @run-at document-end
// @match https://app.hey.com/*
// @grant GM_getValue
// @grant GM_setValue
const BASE_URL_PATTERN = 'https://app\\.hey\\.com'
let UnreadCount = -1;
@donaldguy
donaldguy / bitbar_circleci-check.30s.py
Last active December 12, 2020 22:08
bitbar CircleCI workflow plugin: updated for modern-ish API/setup, dynamic reordering by last run
#!/bin/bash
""":"
exec /usr/bin/env python3 $0
":"""
# -*- coding: utf-8 -*-
# <bitbar.title>CircleCI My Worfklows Check</bitbar.title>
# <bitbar.version>v2.0</bitbar.version>
# <bitbar.author>Donald Guy</bitbar.author>
# <bitbar.author.github>donaldguy</bitbar.author.github>
@donaldguy
donaldguy / cucumber_feature_failures_on_circle.sh
Last active December 12, 2020 22:13
CircleCI failures fetch/local rerun scripts: rspec + cucumber, but not much would be needed to adapt for other langs/libs
#!/bin/bash
#: features_failures_on_circle.sh [job number] [project name]
#:
#: Summarizes recorded CircleCI results for a (parallelized) cucumber suite, with
#: a view towards debugging failures locally on macOS.
#:
#: BE ADVISED: running will overwrite your clipboard. You should consider a
#: clipboard history. I like the one provided by Alfred PowerPack
#:
@donaldguy
donaldguy / aks-kernel-patch.sh
Created August 8, 2018 21:45
Ensure an Ubuntu AKS worker pool is patched against CVE-2018-5390 aka SegmentSmack/FragmentSmack
#!/bin/bash
# This script is intended to ensure an AKS worker pool is patched against CVE-2018-5390 aka SegmentSmack/FragmentSmack
# by ensuring kernel is patched to version 4.15.0-1019
set -eu
case ${1:-} in
-h|--help|help|/?)
echo "Usages:"
echo " To determine unpatched machines and upgrade all (after prompt):"