Skip to content

Instantly share code, notes, and snippets.

View nstrauss's full-sized avatar
💭
🐍 🏫 📡

Nathaniel Strauss nstrauss

💭
🐍 🏫 📡
View GitHub Profile
@weswhet
weswhet / mscupdate.py
Last active June 9, 2024 05:19
quit, update, and reopen all apps that have an update available in Managed Software Center.
#!/usr/local/munki/munki-python
import argparse
import os
import pathlib
import plistlib
import pprint
import pwd
import subprocess
from time import sleep
@scriptingosx
scriptingosx / getDefaultAppForURL.sh
Created August 18, 2023 12:36
two scripts to set and read default app for url schemes (http, mailto, ssh, etc.) for use with Jamf Pro
#!/bin/bash
# this script will return the current default application for a url scheme
# for use as a Jamf Extension attribute
# by Armin Briegel - Scripting OS X
# Permission is granted to use this code in any way you want.
# Credit would be nice, but not obligatory.
# Provided "as is", without warranty of any kind, express or implied.
@macshome
macshome / defang.md
Last active December 15, 2024 21:05
How to defang system protections on macOS

How to Defang macOS System Protections

If you want to change things on the root drive of a Mac you will need to take some steps to disable the built in security of the system. Most of these steps are the same regardless if you are on Intel or Apple Silicon. If there is a difference it is noted.

Note that all of these things put a Mac into an unsupported and less secure state.

Make sure you either perform these steps in a VM or that you reset the protections after you are done poking around

Protections and Terms

(This list is not exahustive on the details of each. Check the links at the end for more info.)

@talkingmoose
talkingmoose / Match Version Number or Higher.bash
Last active October 23, 2024 18:50
Generates a regular expression (regex) that matches the provided version number or higher. Useful for Jamf Pro's "matches regex" operator in searches and smart groups where the results need to be the current version of an app or higher.
#!/bin/bash
<<ABOUT_THIS_SCRIPT
-------------------------------------------------------------------------------
Written by:William Smith
Professional Services Engineer
Jamf
bill@talkingmoose.net
https://gist.github.com/2cf20236e665fcd7ec41311d50c89c0e
@AndrewWCarson
AndrewWCarson / Toggle macOS Theme.py
Created March 29, 2019 23:05
Toggle between Light & Dark mode.
#!/usr/bin/python
#
# This toggles the macOS appearance from Light mode to Dark mode and vice
# versa.
#
# Big thanks to Mike Lynn for his help. Esp. this gist:
# https://gist.github.com/pudquick/ba235b7e90aafb9986158697a457a0d0
#
# Still looking for the function to perfectly simulate changing themes via the
# System Prefs UI. iStat menus seems to not be getting the hint.
@haircut
haircut / modify-system-preferences-authorizations.py
Last active June 5, 2023 16:27
Backs up authdb, then modifies them so users can modify Energy Saver, Network, Printers & Scanners, Date & Time, Time Machine
#!/usr/bin/python
'''
Modifies authorizations database to allow standard users to change select
system preferences.
A great guide to available authorization rights can be found at:
https://www.dssw.co.uk/reference/authorization-rights/index.html
USE AT YOUR OWN RISK
'''
@ipbastola
ipbastola / clean-up-boot-partition-ubuntu.md
Last active August 16, 2024 13:39
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@pudquick
pudquick / get_platform.py
Last active August 18, 2022 21:02
Get Mac's serial number, hardware UUID, and board-id via python
import objc
from Foundation import NSBundle
IOKit_bundle = NSBundle.bundleWithIdentifier_('com.apple.framework.IOKit')
functions = [("IOServiceGetMatchingService", b"II@"),
("IOServiceMatching", b"@*"),
("IORegistryEntryCreateCFProperty", b"@I@@I"),
]