Skip to content

Instantly share code, notes, and snippets.

View jmahlman's full-sized avatar
🍻

John Mahlman jmahlman

🍻
View GitHub Profile
@talkingmoose
talkingmoose / Sonoma-compatible Macs (regex)
Last active December 10, 2023 17:14
Regex looks for all Mac models compatible with macOS Sonoma. May not be up-to-date with newly released models.
https://support.apple.com/en-us/HT213772
Published Date: November 15, 2023
Verification: https://regex101.com/r/GCfKMt/9
1) Exact regex — Matches major model identifier numbers based on Apple's knowledge base article (more accurate):
^(Mac(1[345]|BookPro1[5-8]|BookAir([89]|10)|Pro7)|iMac(Pro1|(19|2[01]))|Macmini[89]),\d+$
2) Current or higher regex — Matches model identifiers based on Apple's knowledge base article and may match higher versions before this regex is updated (more future-proof).
@pudquick
pudquick / brew.md
Last active April 6, 2024 21:42
Lightly "sandboxed" homebrew on macOS

brew is a bad neighbor

This isn't a guide about locking down homebrew so that it can't touch the rest of your system security-wise.

This guide doesn't fix the inherent security issues of a package management system that will literally yell at you if you try to do something about "huh, maybe it's not great my executables are writeable by my account without requiring authorization first".

But it absolutely is a guide about shoving it into its own little corner so that you can take it or leave it as you see fit, instead of just letting the project do what it likes like completely taking over permissions and ownership of a directory that might be in use by other software on your Mac and stomping all over their contents.

By following this guide you will:

  • Never have to run sudo to forcefully change permissions of some directory to be owned by your account
@sdagley
sdagley / McAfeeENS10.7.1postinstall.bash
Last active December 7, 2021 01:40
For use in a package containing all of the McAfee ENS 10.7.1 component ePO installer packages, this postinstall script will install the ENS components in the required order, in kextless mode, then install the PrivilegedHelper tool that was added in 10.7.1
#!/bin/bash
## postinstall
# McAfeeENS10.7.1postinstall.bash
# by Steve Dagley <@sdagley Jamf Nation/Twitter/MacAdmins Slack/GitHub>
# postinstall script for single install package for complete install of McAfee ENS 10.7.1
#
# Incorporate RipOff_Mcafee V2.1 script from MacAdmins Slack #mcafee channel
#
@sdagley
sdagley / RipOff-McAfee v2.1.sh
Last active April 1, 2021 17:09
Based on RipOff-McAfee.sh V2 by adam_scheblein@mcafee.comUpdated launchctl calls to use bootout instead of unloadRemoves Privileged HelperTool added with ENS 10.7.1Terminates McAfee Agent Status Monitor when unloading launch items
#!/bin/sh
## RipOff-McAfee.sh
## version 2.0
##
## Author: Adam Scheblein, McAfee IT
## E-Mail: adam_scheblein@mcafee.com
##
## version 2.1 mods by Steve Dagley <@sdagley Jamf Nation/Twitter/MacAdmins Slack>
## Updated launchctl calls to use bootout instead of unload
@sdagley
sdagley / Install McAfee Agent Status Monitor PrivilegedHelper.sh
Created September 29, 2020 02:26
Install PrivilegedHelper and LaunchDaemon for the McAfee ENS 10.7.1 version of McAfee Agent Status Monitor.app so users aren't prompted for admin credentials to do the install the first time they slect the app from the McAfee Menulet
#!/bin/sh
# Install PrivilegedHelper and LaunchDaemon for the McAfee ENS 10.7.1 version of
# McAfee Agent Status Monitor.app so users aren't prompted for admin credentials to
# do the install the first time they select the app from the McAfee Menulet
helperSourcePath="/Library/Application Support/McAfee/MSS/Applications/McAfee Agent Status Monitor.app/Contents/Library/LaunchServices/com.mcafee.agentMonitor.helper"
helperDestinationPath="/Library/PrivilegedHelperTools/com.mcafee.agentMonitor.helper"
if [ -f "$helperSourcePath" ] && [ ! -f "helperDestinationPath" ]; then
@talkingmoose
talkingmoose / "Early Adopter" extension attribute
Last active November 21, 2023 22:31
Self Service policy to enable end users to enroll their Macs into an "Early Adopter Program" or any other type of enrollment. Create a Smart Computer Group to identify early adopters and scope policies.
#!/bin/zsh
enrollmentStatus=$( /usr/bin/defaults read '/Library/Preferences/EarlyAdopter.plist' Enrolled )
echo "<result>$enrollmentStatus</result>"
@talkingmoose
talkingmoose / Generate Random Firmware Password.bash
Last active July 20, 2021 15:30
Generate a randome EFI firmware password for each Mac and store in Jamf Pro. Note: This will be completely visible to all Jamf Pro users whose permissions allow access to Computers. Create an extension attritute with the first script.
#!/bin/bash
function logresult() {
if [ $? = "0" ] ; then
echo "$1"
else
echo "$2"
exit 1
fi
}
#!/bin/bash
# geoff repoli
# customize this variable with relatively unique + identifiable string that matches the process(es)
# you want to terminate. not case-sensitive. for example:
# for all microsoft applications + background services: application="microsoft"
# for microsoft outlook: application="outlook" OR application="microsoft outlook"
application="your string goes here"
# get pids of any running microsoft processes
<?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>
<key>PayloadContent</key>
<array>
<dict>
<key>PayloadContent</key>
<dict>
<key>com.apple.touristd</key>
@calum-github
calum-github / format_hd.sh
Last active August 10, 2020 21:20
Disk formatter
#!/bin/bash
########################################################################
# Author: Calum Hunter #
# Date: 21/12/2016 #
# Version: 0.7 #
# Purpose: Fusion Drive Detection and general HD formatting before #
# imaging tasks. #
# #
########################################################################