Skip to content

Instantly share code, notes, and snippets.

View lucascantor's full-sized avatar

Lucas Cantor lucascantor

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).
@talkingmoose
talkingmoose / Monterey-compatible Macs (regex).txt
Last active February 5, 2023 18:45
Regex looks for all Mac models compatible with macOS Monterey. May not be up-to-date with newly released models.
Model information: https://support.apple.com/en-us/HT212551
Published Date: June 24, 2022
Verification: https://regex101.com/r/OozSRv/9
1) Regex matches major identifier — Matches major model identifier numbers based on Apple's knowledge base article (more accurate):
(^Mac1[34]|MacBook(10|9)|MacBookAir(10|[7-9])|Macmini[7-9]|MacPro[6-7]|iMacPro1|iMac(1[6-9]|2[0-2])),\d|MacBookPro1(1,[45]|[2-8],\d)
2) Regex matches current or higher — Matches model identifiers based on Apple's knowledge base article and may match higher versions before this regex is updated (more future-proof).
@gaosa
gaosa / squircle.swift
Created December 21, 2019 12:09
Squircle in SwiftUI
// Run in Swift Playground
import SwiftUI
import PlaygroundSupport
struct ContentView: View {
var body: some View {
Rectangle()
.fill(Color.red)
.frame(width: 200, height: 200)
@talkingmoose
talkingmoose / Manage App Notifications.bash
Last active January 25, 2024 15:26
macOS Catalina will prompt users to allow Notifications from each app that makes a request. Administrators can manage these prompts using a Configuration Profile. If running Jamf Pro 10.19 or later, I suggest instead using this manifest: https://github.com/talkingmoose/jamf-manifests/blob/master/macOS%20Notifications%20(com.apple.notificationset…
#!/bin/bash
<<ABOUT_THIS_SCRIPT
-----------------------------------------------------------------------
Written by:William Smith
Professional Services Engineer
Jamf
bill@talkingmoose.net
https://gist.github.com/talkingmoose/9faf50deaaefafa9a147e48ba39bb4b0
@talkingmoose
talkingmoose / Set Computer PreStage Scope.bash
Last active February 18, 2023 00:36
As of Jamf Pro 10.14, the Jamf Pro API (/uapi) allows access to create and update scopes for computer PreStage Enrollments. Edit the information at the top and include a list of computer serial numbers for the COMPLETE scope. (The script replaces the scope list; it doesn't update.) Be sure to leave the opening and closing parentheses.
#!/bin/bash
# server connection information
URL="https://talkingmoose.jamfcloud.com"
username="API-Editor"
password="P@55w0rd"
# provide the Jamf Pro ID of the PreStage Enrollment; look in the URL when viewing the PreStage Enrollment
prestageID="1"
@scriptingosx
scriptingosx / bashdisplay.sh
Last active December 10, 2022 15:51
bash functions using osascript to use some user interaction on macOS
#!/bin/bash
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
consoleUser() {
echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ && ! /loginwindow/ { print $3 }'
}
displaydialog() { # $1: message
message=${1:-"Message"}
@opragel
opragel / forcefully_remove_mdm_1015.sh
Last active August 2, 2022 19:39
forcefully_remove_mdm_1015.sh
#!/bin/bash
# Seriously there still apparently aren't enough warning labels
# If you don't understand the consequences don't do it
REMOVE_PATHS=( # "/var/db/ConfigurationProfiles/.passcodePolicesAreInstalled"
# "/var/db/ConfigurationProfiles/.cloudConfigHasActivationRecord"
# "/var/db/ConfigurationProfiles/.cloudConfigNoActivationRecord"
# "/var/db/ConfigurationProfiles/.cloudConfigProfileObtained"
# "/var/db/ConfigurationProfiles/.cloudConfigRecordFound"
# "/var/db/ConfigurationProfiles/.profilesAreInstalled"
@haircut
haircut / System - Software Updates.mobileconfig
Created October 10, 2017 01:02
Manage macOS Software Update settings via configuration profile (Jamf Pro)
<?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.SoftwareUpdate</key>
@superdaigo
superdaigo / ForcePasswordRequiredImmediatelyAfterScreenSaver.mobileconfig
Created July 15, 2016 05:18
This profile force OS X (at least 10.11.5) to require password immediately after screen saver begins. (ref. http://www.johnkitzmiller.com/blog/security-privacy-configuration-profile-bug-in-casper-9-82/)
<?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>PayloadDescription</key>
<string>Screen saver password settings</string>
<key>PayloadIdentifier</key>
@tals
tals / meldium_to_1password.py
Last active June 6, 2017 23:01
Meldium to 1Password converter
"""
1Password is good at a lot of things. Importing CSV is not one of them (as of 5.5.BETA-29).
Converts a Meldium CSV to something 1Password will import correctly.
To export: http://support.meldium.com/knowledgebase/articles/656755-export-meldium-data-to-a-spreadsheet
"""
import csv
import sys