Skip to content

Instantly share code, notes, and snippets.

View JayBrown's full-sized avatar

Joss Brown JayBrown

View GitHub Profile
@JayBrown
JayBrown / applaunched.sh
Last active June 4, 2023 21:14
macOS LSIsAppleDefaultNoOverrideForType to automatically open pkg or mpkg installer files in Suspicious Package or Pacifist in addition to macOS Installer app / prerequisites: EventScripts app or NSWorkspaceNotifications observer for NSWorkspaceDidLaunchApplicationNotification
#!/bin/zsh
# shellcheck shell=bash
# applaunched v0.2
export LANG=en_US.UTF-8
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/opt/local/bin:/opt/local/sbin:"$HOME"/.local/bin:"$HOME"/.local/sbin
logloc="/tmp/local.$(id -un).applaunched.log"
exec > >(tee -a "$logloc") 2>&1
@JayBrown
JayBrown / twitter2google.sh
Last active January 23, 2023 13:42
macOS shell script for Automator QuickAction: send Twitter $ search terms to Google search
# Twitter to Google search
# 0.1
export LANG=en_US.UTF-8
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/opt/local/bin:/opt/local/sbin:"$HOME"/.local/bin:"$HOME"/.local/sbin
_beep () {
osascript -e 'beep' -e 'delay 0.5' &>/dev/null
}
@JayBrown
JayBrown / addloc
Last active July 19, 2023 20:13
Add CLIs to /var/db/locationd/clients.plist (macOS Location Services)
#!/bin/zsh
# shellcheck shell=bash
# addloc 0.2.1 (beta)
# add CLIs to /var/db/locationd/clients.plist
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/opt/local/bin:/opt/local/sbin:"$HOME"/.local/bin:"$HOME"/.local/sbin
rehash &>/dev/null
@JayBrown
JayBrown / imgur-au
Last active March 2, 2021 20:54
imgurAU – imgur anonymous uploader for online images (shell script to use in Firefox using the OpenWith browser extension)
#!/bin/zsh
# shellcheck shell=bash
# imgur-au
# v0.4
# imgur anonymous uploader
export LANG=en_US.UTF-8
export PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin:/opt/local/bin:/opt/homebrew/bin:$HOME/.local/bin:$HOME/bin:$HOME/local/bin
@JayBrown
JayBrown / reconnect
Last active March 1, 2021 14:34
Fritz!Reconnect (macOS) – tell Fritz!Box to reconnect to WAN to get a new public IP address (tested on model 7490)
#!/bin/zsh
# shellcheck shell=bash
# reconnect v0.2
# macOS / Fritz!Box (tested on model 7490)
export LANG=en_US.UTF-8
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
###
#!/bin/zsh
# shellcheck shell=bash
# wifi-auto-switch.zsh for macOS
# v0.2
emulate -LR bash
export LANG=en_US.UTF-8
# switch WiFi network function
@JayBrown
JayBrown / ckimg
Last active October 24, 2022 18:02
macOS: check if a disk image is APFS-formatted
#!/bin/bash
# ckimg v0.5
for filepath in "$@"
do
shortpath="${filepath/#$HOME/~}"
filename=$(basename "$filepath")
echo "Accessing: $shortpath"
extension="${filename##*.}"
@JayBrown
JayBrown / rm-dsstore
Last active June 4, 2023 22:36
quick script to run a .DS_Store deletion process on volumes
#!/bin/zsh
# shellcheck shell=bash
# rm-dsstore v0.2
# macOS Catalina and later only!
if [[ $(id -u) != 0 ]] ; then
echo "Please run as root user!" >&2
exit
fi
@JayBrown
JayBrown / ejecta
Last active June 4, 2023 22:35
Ejecta: correctly eject APFS-formatted DMGs (raw version)
#!/bin/zsh
# shellcheck shell=bash
# ejecta v0.11
# https://gist.github.com/JayBrown/da7da1ef88cdce264fb47495a0fd34c4
export PATH=/usr/bin:/usr/sbin:/bin:/sbin
_beep () {
osascript -e 'beep' -e 'delay 0.5' &>/dev/null
@JayBrown
JayBrown / 14.pip
Created November 28, 2016 16:14
mapbox CLI: update error v0.4.0 > v0.5.1 via homebrew (OS X 10.11.6)
2016-11-27 17:57:39 +0100
/usr/local/Cellar/mapbox/0.5.1/libexec/bin/pip
install
-v
--no-deps
--no-binary
:all:
--ignore-installed
/private/tmp/mapbox--polyline-20161127-75577-1ha0sdu/polyline-1.3.1