Skip to content

Instantly share code, notes, and snippets.

View melmatsuoka's full-sized avatar

Mel Matsuoka melmatsuoka

View GitHub Profile
#!/bin/zsh
:<<ABOUT_THIS_SCRIPT
-----------------------------------------------------------------------
Written by:William Smith
Partner Program Manager
Jamf
bill@talkingmoose.net
https://gist.github.com/talkingmoose/15f055885b51cc8cb0bc7aad021acead
#!/usr/bin/env zsh
#===========================================================================
# * INFO
#
# macOS Preferences Defaults
# By Christopher Allen @ChristopherA https://github.com/christophera/
# My most basic macOS preferences, in this gist to make it easy to load on
# multiple machines and VMs. Ideally runs on all macOS versions since Yosemite,
@melmatsuoka
melmatsuoka / toggle_functionkeys.sh
Created January 30, 2024 15:15
Toggle Function/Media keys on macOS
#!/bin/bash
#
# Toggles the state of the "Use F1, F2, etc. keys as standard function keys" option
# in the System Keyboard Shortcuts settings in Ventura & Sonoma
if [[ $(defaults read -g 'com.apple.keyboard.fnState') == '0' ]]
then
defaults write -g 'com.apple.keyboard.fnState' -boolean true
else defaults write -g 'com.apple.keyboard.fnState' -boolean false
fi
@melmatsuoka
melmatsuoka / Re-enable Apple Watch & Touch ID support for 'sudo' after macOS updates.txt
Created September 8, 2023 18:47
Re-enable Apple Watch & Touch ID support for 'sudo' after macOS updates
echo -e "auth sufficient pam_watchid.so\nauth sufficient pam_tid.so" | cat - /etc/pam.d/sudo | sudo tee /etc/pam.d/sudo > /dev/null
@melmatsuoka
melmatsuoka / resolve_clickPositionLock.applescript
Last active July 10, 2023 14:23
AppleScript that uses GUI Scripting to toggle the "Position Lock" button in the Edit page (as of Resolve 18.1.4, you can't map a keyboard shortcut to this in the native keyboard Shortcuts prefs). This also requires 'clicliclick' (available from Homebrew). Note that the checkbox index is unfortunately a moving target in Resolve. In Resolve 18.1.4…
(*
AppleScript example that uses GUI Scripting to toggle the "Position Lock" button in the Edit page
(as of Resolve 18.1.4, you can't map a keyboard shortcut to this in the native keyboard Shortcuts
prefs).
This also requires 'cliclick' (available from Homebrew).
Note that the checkbox index is unfortunately a moving target in Resolve. In Resolve 18.1.4,
"checkbox 21" will target the Position Lock button ONLY if the "Media Pool" and "Edit Index" panels
are open in the Edit Page. If any other panels are open, the checkbox index will change!
@melmatsuoka
melmatsuoka / avid_blendx_check.sh
Last active June 12, 2023 13:05
Checks if the "Blend-X" plugin for Avid Media Composer is installed (Mosyle/MDM)
#!/usr/bin/env bash
#
# To create a Mosyle Device Group containing systems that do/don't have the plugin installed,
# enable the "Show the command response as an attribute on Device Info" checkbox in the
# Custom Command profile for this script, and create an attribute label for it. Then
# you can use the value stored in that Custom Attribute label as the Criteria for building
# the device group.
#
# This is handy for showing the Blend-X installer in Mosyle Self Service only on machines
# that don't already have it installed.
@melmatsuoka
melmatsuoka / get_opnsense_password.sh
Created June 12, 2023 12:20
This automatically outputs the concatenated OTP+Password that the OPNsense admin login fields expects when you're using a 2FA protected account. Requires 1Password CLI
#!/usr/bin/env bash
vault_item_uuid="YOUR VAULT ITEM UUID"
opnsense_otp=$(op item get ${vault_item_uuid} --otp)
opnsense_pwd=$(op item get ${vault_item_uuid} --fields password)
# "pbcopy" is a macOS only built-in that copies whatever was piped to it to the system clipboard
echo -n "$opnsense_otp$opnsense_pwd" | pbcopy
@melmatsuoka
melmatsuoka / startMinimized.applescript
Created May 18, 2018 18:47
Launch macOS app in minimized state.
-- Launches BusyCal in minimized mode.
-- If it's already running, then don't do anything.
tell application "System Events" to (name of processes) contains "BusyCal"
if the result is false then
activate application "BusyCal"
tell application "System Events"
set visible of process "BusyCal" to false
end tell
end if
@melmatsuoka
melmatsuoka / extract_r3d_filename.sh
Last active May 18, 2018 01:45
Extract original filename of renamed .R3D file
#!/bin/bash
#
# Extract the original filename of renamed .R3D file. This is useful for reconstructing
# R3D files restored from a data-recovery operation from an HFS+ drive.
#
# note: the “-m 1” argument tells grep to stop after the first returned match.
# The pipe to "cut” is a dumb way to trim the leading “V” character on the returned filename
strings "FILE.R3D" | grep -m 1 -E "^.*[A-Z][0-9]{3}_[A-Z][0-9]{3}_[0-9]{4}[A-Z0-9]{2}_[0-9]{3}.R3D" | cut -c2-
@melmatsuoka
melmatsuoka / diceware.sh
Last active August 29, 2015 14:18
Generates a Diceware passphrase, and copies it to the OSX system clipboard, ready for pasting into a password manager. Usage: diceware <wordcount (default: 8)> <delimiter (default:space)>
#!/bin/bash
#
# diceware(): Generate a Diceware passphrase
#
# note: This script has OSX-specific dependencies (pbcopy, pbpaste)
function diceware() {
# arg1: wordcount (default = 8)
# arg2: delimiter (default = space)