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 | |
# A dictionary of information about connected AC adaptor for Mac laptops | |
from SystemConfiguration import ( | |
SCDynamicStoreCreate, | |
SCDynamicStoreCopyValue, | |
) | |
ds = SCDynamicStoreCreate(None, 'power', None, None) | |
result = SCDynamicStoreCopyValue(ds, 'State:/IOKit/PowerAdapter') | |
# Returns nothing if no adaptor connected. |
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 | |
# A dictionary of current power settings from various system configurations | |
from SystemConfiguration import ( | |
SCDynamicStoreCreate, | |
SCDynamicStoreCopyValue, | |
) | |
ds = SCDynamicStoreCreate(None, 'power', None, None) | |
result = SCDynamicStoreCopyValue(ds, 'State:/IOKit/PowerManagement/CurrentSettings') |
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 | |
# A dictionary of system load information. | |
from SystemConfiguration import ( | |
SCDynamicStoreCreate, | |
SCDynamicStoreCopyValue, | |
) | |
ds = SCDynamicStoreCreate(None, 'power', None, None) | |
result = SCDynamicStoreCopyValue(ds, 'State:/IOKit/PowerManagement/SystemLoad/Detailed') |
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 | |
# A dictionary of available CPU's, COU scheduler limit, and CPU speed limit | |
from SystemConfiguration import ( | |
SCDynamicStoreCreate, | |
SCDynamicStoreCopyValue, | |
) | |
ds = SCDynamicStoreCreate(None, 'power', None, None) | |
result = SCDynamicStoreCopyValue(ds, 'State:/IOKit/Power/CPUPower') # returns nothing on Apple Silicon |
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 | |
# A dictionary of SMB server configuration settings | |
from SystemConfiguration import ( | |
SCDynamicStoreCreate, | |
SCDynamicStoreCopyValue, | |
) | |
ds = SCDynamicStoreCreate(None, 'smb', None, None) | |
result = SCDynamicStoreCopyValue(ds, 'com.apple.smb') |
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 | |
# A dictionary detailing what logging is configured for mDNS debugging | |
from SystemConfiguration import ( | |
SCDynamicStoreCreate, | |
SCDynamicStoreCopyValue, | |
) | |
ds = SCDynamicStoreCreate(None, 'mDNS', None, None) | |
result = SCDynamicStoreCopyValue(ds, 'State:/Network/mDNSResponder/DebugState') |
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 | |
# 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') |
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/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 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 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, |
OlderNewer