This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
(while sleep 30; do osascript -e 'set Volume 2' && say bacon; done) & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import CoreLocation | |
CLValidAuth = [CoreLocation.kCLAuthorizationStatusAuthorized] | |
def locationServicesEnabled(): | |
if CoreLocation.CLLocationManager.locationServicesEnabled(): | |
return True | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Modify these strings to change the verbiage in the badge notification. | |
title="Updates Applied" | |
description="macOS updates have been applied to your device. Please restart to complete the process." | |
acceptText="Restart" | |
closeText="Later" | |
if (( $(softwareupdate -l 2>&1 | grep -c ' *') > 0 )); then | |
softwareupdate -ia |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import subprocess | |
import plistlib | |
def get32BitApps(): | |
cmd = '/usr/sbin/system_profiler -xml SPApplicationsDataType' | |
p = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
out, err = p.communicate() | |
if p.returncode != 0: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import CoreLocation | |
def locationServicesEnabled(): | |
if CoreLocation.CLLocationManager.locationServicesEnabled(): | |
return True | |
else: | |
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KEXT_TEAM_ID="ABCDEFG" | |
majorVersion=$(sw_vers -productVersion | awk -F. '{print $2}') | |
minorVersion=$(sw_vers -productVersion | awk -F. '{print $3}') | |
echo "Major macOS version: $majorVersion" | |
echo "Minor macOS version: $minorVersion" | |
if (( majorVersion > 13 )) || (( majorVersion == 13 && minorVersion > 2 )); then | |
if ! /usr/bin/sqlite3 /var/db/SystemPolicyConfiguration/KextPolicy "SELECT team_id FROM kext_policy_mdm;" | /usr/bin/grep "$KEXT_TEAM_ID"; then | |
echo 'Kernel extension not whitelisted.' | |
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# Based on some nice gists by Mike Lynn (@pudquick) | |
import objc | |
from CoreFoundation import NSBundle | |
IOKit_bundle = NSBundle.bundleWithIdentifier_('com.apple.framework.IOKit') | |
functions = [("IOServiceGetMatchingService", b"II@"), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This requires the parent process to have "System Events" enabled in TCC. When | |
# running this from Addigy, /Library/Addigy/go-agent will need that | |
# whitelist. | |
username=$(/usr/bin/python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\n");') | |
# Do nothing if no one logged in. | |
if [[ "$username" != "" ]]; then | |
# Tell "System Events" to change to light mode. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python | |
from ctypes import CDLL, c_uint, byref, create_string_buffer | |
libc = CDLL('/usr/lib/libc.dylib') | |
def sysctl(name): | |
size = c_uint(0) | |
libc.sysctlbyname(name, None, byref(size), None, 0) | |
buf = create_string_buffer(size.value) | |
libc.sysctlbyname(name, buf, byref(size), None, 0) |