This file contains hidden or 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 | |
'''List APFS containers and return properties. Free to use/abuse/improve/laugh at''' | |
import plistlib | |
import subprocess | |
import sys | |
from collections import namedtuple | |
This file contains hidden or 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/sh | |
# User path | |
/usr/bin/getconf DARWIN_USER_DIR | |
# Temp directory | |
# Note - $TMPDIR is the same as this | |
/usr/bin/getconf DARWIN_USER_TEMP_DIR | |
# Cache directory |
This file contains hidden or 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/sh | |
# Shamelessly stolen from https://loefflmann.blogspot.com.au/2015/03/finding-os-x-version-and-build-in-install-os-x-app.html | |
# Provide the path to the installer file from the command line. | |
if [[ ! -z $1 ]]; then | |
os_installer_path="$1" | |
echo "Attaching ${1}" | |
hdiutil attach "${os_installer_path}/Contents/SharedSupport/InstallESD.dmg" -quiet -noverify -nobrowse -mountpoint /Volumes/InstallESD.$$ | |
hdiutil attach "/Volumes/InstallESD.$$/BaseSystem.dmg" -quiet -noverify -nobrowse -mountpoint /Volumes/BaseSystem.$$ |
This file contains hidden or 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 | |
'''Converts a standard Wi-Fi configuration profile for iOS/macOS that uses | |
a user certificate, and converts it into a SystemConfiguration profile type | |
that can be used to connect to a Wi-Fi network at macOS login screen. | |
This is useful where you need a laptop to be able to bind to an AD or LDAP | |
server, or just want to have user credential free Wi-Fi connection at the | |
system level.''' | |
import os | |
import plistlib |
This file contains hidden or 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/sh | |
# Get network interface. We sleep so that the interface has a chance to come up! | |
# Substitute the 0.0.0.0 address if you have a specific route that you want to test, however this may impact | |
# portability if a machine spends more time without access to that route than with. | |
# Give the interface a chance to come up - useful if this is used in any boot up processes | |
while [ $(route get 0.0.0.0 2>/dev/null | grep -c interface) != 1 ]; do | |
sleep 5 | |
done |
This file contains hidden or 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 | |
# Function returns a dict containing the results of `diskutil info /dev/disk` | |
import plistlib | |
import subprocess | |
def disk_info(disk): | |
cmd = ['/usr/sbin/diskutil', 'info', '-plist', disk] | |
(results, error) = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() |
This file contains hidden or 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 | |
# Use system_profiler output in XML to get information about Mac hardware | |
import plistlib | |
import subprocess | |
cmd = ['system_profiler', '-xml', 'SPHardwareDataType'] | |
(results, error) = subprocess.Popen(cmd, |
This file contains hidden or 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/sh | |
/bin/chmod -R 755 /usr/local/share/promethean | |
/bin/chmod -R 644 /Library/LaunchAgents/com.promethean.* | |
/bin/chmod -R 755 /usr/local/lib | |
This file contains hidden or 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/sh | |
# This will also work with /Search/Users instead of /Local/Users | |
/usr/bin/dscl localhost -list /Local/Users UniqueID | awk '$2 >= 100 { print $1 "," }' | grep -v "^_" > users.csv |
This file contains hidden or 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 | |
# A dictionary of detailed proxy information as seen in the Network system preference pane. | |
from SystemConfiguration import ( | |
SCDynamicStoreCreate, | |
SCDynamicStoreCopyValue, | |
) | |
ds = SCDynamicStoreCreate(None, 'global_proxies', None, None) | |
result = SCDynamicStoreCopyValue(ds, 'State:/Network/Global/Proxies') |