Skip to content

Instantly share code, notes, and snippets.

View dstranathan's full-sized avatar

Daniel Stranathan dstranathan

View GitHub Profile
@talkingmoose
talkingmoose / iOS and iPadOS 17 compatible devices (regex)
Last active June 22, 2023 16:28
Regex looks for all iPhone and iPad models compatible with iOS or iPadOS 17. May not be up-to-date with newly released models.
https://www.apple.com/ios/ios-17-preview/
https://www.apple.com/ipados/ipados-17-preview/
Published Date: June 5, 2023
Verification: https://regex101.com/r/m9HV8T/3
1) Exact regex — Matches major model identifier numbers based on Jamf's hardware model identifiers list (more accurate):
^iPhone1[1-5],\d|iPad([7-9]|1[1-4]),\d+$
@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).
@PicoMitchell
PicoMitchell / rosetter.sh
Last active January 4, 2024 17:22
"rosetter" is a shell/CLI tool to enable (or disable) opening apps using Rosetta on Apple Silicon Macs (as if you had clicked the "Open using Rosetta" checkbox in Finder).
#!/bin/sh
rosetter() ( # Notice "(" instead of "{" for this function, see THIS IS A SUBSHELL FUNCTION comments below.
# ABOUT ROSETTER
# "rosetter" is a shell/CLI tool to enable (or disable) opening apps using Rosetta on Apple Silicon Macs (as if you had clicked the "Open using Rosetta" checkbox in Finder).
# To enable opening apps using Rosetta, simply pass "rosetter" the app path(s) and/or bundle identifier(s) as arguments that you would like to enable opening using Rosetta (multiple app paths and/or bundle identifiers can be enabled at once).
# To disable opening apps using Rosetta, include the "--disable" (or "-d") argument along with the app path(s) and/or bundle identifier(s).
##
//
// MIT License
//
// Copyright (c) 2022 Simon Andersen
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
@apizz
apizz / Install_AirPrint_Printer.sh
Last active May 1, 2024 14:34
Programmatically adds an AirPrint printer, ideally with an icon
#!/bin/bash
# Use the built-in ipp2ppd tool to create a PPD file for AirPrint
# Add icon to PPD (if we can get one) and install the printer
# Required printer info
readonly PRINTER_IP='XXX.XXX.XXX.XXX'
readonly PRINTER_NAME='PRINTER_NAME'
readonly PRINTER_DISPLAY_NAME='PRINTER NAME'
readonly PRINTER_LOCATION='PRINTER LOCATION'
@talkingmoose
talkingmoose / MegaPKGr.zsh
Last active June 26, 2023 05:37
The pkgbuild binary and Jamf Composer don't support adding single files of 8 GB or more to a package. Some apps like Install macOS Big Sur.app include files larger than 8 GB in their bundles. This script will create a deployable PKG file from apps whose bundles include those large files.
#!/bin/zsh
:<<ABOUT_THIS_SCRIPT
-------------------------------------------------------------------------------
Written by:William Smith
Professional Services Engineer
Jamf
bill@talkingmoose.net
https://gist.github.com/e9ed319226c6da30dd633725e48a97b0
@mrpnelson
mrpnelson / mac-wipri.sh
Last active November 16, 2022 15:22
Mac WiFi Preferred Network Refresh Script
#!/bin/bash
# ------------------------------------------------------------------------------------------
# May 4, 2021 Update
# This is maintained here for reference, but it seems like the networksetup script
# is capable of doing this, at least in Big Sur. I haven't tested this on older versions.
# See https://gist.github.com/mrpnelson/c65302efed6c18300fb28c8da87bc69a#gistcomment-3731567
# for details on using the native tooling
# ------------------------------------------------------------------------------------------
@arekdreyer
arekdreyer / postinstall-for-Composer-for-DEPNotify.zsh
Last active April 5, 2024 21:36
Postinstall script for Jamf Composer to install DEPNotify with supporting scripts and a LaunchDaemon
#!/bin/zsh
## postinstall
pathToScript=$0
pathToPackage=$1
targetLocation=$2
targetVolume=$3
# This postinstall script for Composer creates the following
# A LaunchDaemon that starts a separate script to run a Jamf Pro policy command
@apizz
apizz / EA_Clear_Failed_MDM_Commands.sh
Last active May 17, 2023 20:08
Jamf extension attribute for checking for and removing any failed macOS MDM commands
#!/bin/bash
jssurl="https://yourjss.com"
apiuser="yourapiuser"
apipass="yourapiuserpass"
serial=$(/usr/sbin/ioreg -rd1 -c IOPlatformExpertDevice | /usr/bin/awk -F'"' '/IOPlatformSerialNumber/{print $4}')
####### FUNCTIONS
clearfailedmdmcommands () {
@rtrouton
rtrouton / gist:3ac68ac3770ab23ebae354c581f526b7
Last active April 23, 2024 01:17
MigrateADMobileAccountToLocalAccount.command script
#!/bin/bash
# Modified 4/5/2019
Version=1.4
# Original source is from MigrateUserHomeToDomainAcct.sh
# Written by Patrick Gallagher - https://twitter.com/patgmac
#
# Guidance and inspiration from Lisa Davies:
# http://lisacherie.com/?p=239
#
# Modified by Rich Trouton