Skip to content

Instantly share code, notes, and snippets.

View notverypc's full-sized avatar
🍰
Cake or Death?

Ben notverypc

🍰
Cake or Death?
View GitHub Profile
@talkingmoose
talkingmoose / iOS and iPadOS 18 and watchOS 11 compatible devices (regex)
Last active January 17, 2025 15:43
Regex looks for all iPhone and iPad models compatible with iOS or iPadOS 18 and Apple Watch models compabiel with watchOS 11. May not be up-to-date with newly released models.
https://support.apple.com/guide/iphone/iphone-models-compatible-with-ios-18-iphe3fa5df43/ios
https://support.apple.com/guide/ipad/ipad-models-compatible-with-ipados-18-ipad213a25b2/ipados
https://www.apple.com/watchos/watchos-11/
Published Date: June 10, 2024
Updated November 1, 2024
Verification: https://regex101.com/r/0UDJHk/7
1) Exact regex — Matches major model identifier numbers based on Jamf's hardware model identifiers list (more accurate):
@talkingmoose
talkingmoose / Sequoia-compatible Macs (regex)
Last active May 28, 2025 13:43
Regex looks for all Mac models compatible with macOS Sequoia. May not be up-to-date with newly released models.
https://www.apple.com/macos/macos-sequoia/
Published Date: June 10, 2024
Updated November 8, 2024
Updated May 28, 2025
Verification: https://regex101.com/r/bNOMXz/10
1) Exact regex — Matches major model identifier numbers based on Apple's knowledge base article (more accurate):
^(Mac(1[3-6]|BookPro1[5-8]|BookAir(9|10)|Pro7)|iMac(Pro1|(19|2[01]))|Macmini[89]),\d+$
@talkingmoose
talkingmoose / Sonoma-compatible Macs (regex)
Last active December 13, 2024 21:37
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: March 8, 2024
Verification: https://regex101.com/r/GCfKMt/11
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).
@stephancasas
stephancasas / toggle-ventura-sidecar.jxa.js
Last active July 15, 2025 09:40
Toggle sidecar or screen mirroring from Control Center in macOS Ventura
#!/usr/bin/env osascript -l JavaScript
/**
* -----------------------------------------------------------------------------
* Activate Sidecar/Screen Mirroring from Control Center
* -----------------------------------------------------------------------------
*
* Created on February 17, 2023 by Stephan Casas
* Updated on May 18, 2023 by Stephan Casas
*
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": [
"comment",
"comment.block",
"comment.block.documentation",
"comment.line",
"constant",
"constant.character",
@nikolay-n
nikolay-n / defsmon.py
Last active October 29, 2022 14:26
Defaults Monitor - tool to sniff defaults keys and values using unified log
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
'''
Defaults Monitor - tool to sniff defaults keys and values using unified log
to launch use standard python 2.7, eg python2.7 ./defsmon.py
'''
import os
@carlashley
carlashley / add_hostArchitectures.py
Last active November 27, 2020 08:52
Bulk add the arm64,x86_64 host architecture value to Packages .pkgproj files.
#!/usr/local/bin/python3
"""Bulk adds the 'arm64,x86_64' value as and advanced option for '.pkgproj' files.
Walks all sub directories specified at '[path]' for '.pkgproj' files, makes a backup
file in the same destination.
Does not add the value if a value already exists.
Usage: ./add_hostArchitectures.py [path]
Tested with Python 3.7.9.
"""
@scriptingosx
scriptingosx / runAsUser.sh
Last active May 13, 2025 08:02
template script for macOS which can run a command as the currently logged in user. https://scriptingosx.com/2020/08/running-a-command-as-another-user/
#!/bin/sh
# template script for running a command as user
# The presumption is that this script will be executed as root from a launch daemon
# or from some management agent. To execute a single command as the current user
# you can use the `runAsUser` function below.
# by Armin Briegel - Scripting OS X
#
@talkingmoose
talkingmoose / Location Information.zsh
Last active December 3, 2024 15:29
Add the following script to a Jamf Pro extension attribute to collect service provider location information based on public IP address when updating inventory.
#!/bin/zsh
# provide for Big Sur and earlier
xpath() {
# the xpath tool changes in Big Sur
if [[ $( /usr/bin/sw_vers -buildVersion) > "20A" ]]; then
/usr/bin/xpath -e "$@"
else
/usr/bin/xpath "$@"
fi
@erikng
erikng / 32bitapps.py
Last active April 16, 2018 11:46
32bitapps.py
#!/usr/bin/python
import subprocess
import plistlib
cmd = ['/usr/sbin/system_profiler', '-xml', 'SPApplicationsDataType']
proc = subprocess.Popen(cmd, shell=False, bufsize=-1, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, err = proc.communicate()
plist = plistlib.readPlistFromString(output)
items = plist[0]['_items']
for item in sorted(items, key=lambda x: x.get('path')):