| Country | ISO 3166 | Region |
|---|---|---|
| Afghanistan | AF | EMEA |
| Åland Islands | AX | EMEA |
| Albania | AL | EMEA |
| Algeria | DZ | EMEA |
| American Samoa | AS | APAC |
| Andorra | AD | EMEA |
| Angola | AO | EMEA |
| Anguilla | AI | AMER |
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 | |
| # As written, this requires the following: | |
| # - OS X 10.6+ (may not work in 10.10, haven't tested) | |
| # - python 2.6 or 2.7 (for collections.namedtuple usage, should be fine as default python in 10.6 is 2.6) | |
| # - pyObjC (as such, recommended to be used with native OS X python install) | |
| # Only tested and confirmed to work against 10.9.5 | |
| # Run with root |
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 | |
| import plistlib, os.path, os | |
| # Based off of https://forums.developer.apple.com/message/6741 | |
| # and http://apple.stackexchange.com/a/136976 | |
| def jdk_info_plists(): | |
| # Find all the JDK Info.plist files | |
| JDK_ROOT = "/Library/Java/JavaVirtualMachines" | |
| if (os.path.exists(JDK_ROOT) and os.path.isdir(JDK_ROOT)): |
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
| from ctypes import CDLL, c_uint, byref, create_string_buffer | |
| from ctypes.util import find_library | |
| libc = CDLL(find_library("c")) | |
| def sysctl(name, isString=True): | |
| size = c_uint(0) | |
| # Find out how big our buffer will be | |
| libc.sysctlbyname(name, None, byref(size), None, 0) | |
| # Make the buffer | |
| buf = create_string_buffer(size.value) |
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 | |
| # (Note that we must use system Python on a Mac.) | |
| #### | |
| # Quick script to get the computer's serial number. | |
| # | |
| # Written for @john.e.lamb on the MacAdmins Slack team. | |
| import objc | |
| import CoreFoundation |
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
| # This file parses this file: | |
| # https://github.com/Piker-Alpha/macosxbootloader/blob/El-Capitan/src/boot/NetBootImages.h | |
| # and this one: | |
| # https://github.com/Piker-Alpha/macosxbootloader/blob/El-Capitan/src/boot/AppleLogoData.h | |
| from ctypes import CDLL, create_string_buffer, c_size_t, c_void_p | |
| import re | |
| CPK = CDLL('/System/Library/PrivateFrameworks/PackageKit.framework/Versions/Current/PackageKit') | |
| lzvn_decode = CPK.lzvn_decode |
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
| import objc | |
| from Foundation import NSBundle | |
| IOKit_bundle = NSBundle.bundleWithIdentifier_('com.apple.framework.IOKit') | |
| functions = [("IOServiceGetMatchingService", b"II@"), | |
| ("IOServiceMatching", b"@*"), | |
| ("IORegistryEntryCreateCFProperty", b"@I@@I"), | |
| ] |
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
| import objc | |
| # Set up opaque types for undefined signatures so we don't have | |
| # to deal with "PyObjCPointer created:" errors | |
| ODNode = objc.createOpaquePointerType("ODNode", b"^{_ODNode=}", None) | |
| ODRecord = objc.createOpaquePointerType("ODRecord", b"^{_ODRecord=}", None) | |
| from OpenDirectory import ODNodeCreateWithNodeType, ODNodeCopyRecord, ODRecordVerifyPassword, kODNodeTypeAuthentication, kODRecordTypeUsers | |
| directory_service, err = ODNodeCreateWithNodeType(None, None, kODNodeTypeAuthentication, None) |
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
| import struct, objc | |
| from Foundation import NSBundle | |
| from Cocoa import NSAppleEventDescriptor | |
| def OSType(s): | |
| # Convert 4 character code into 4 byte integer | |
| return struct.unpack('>I', s)[0] | |
| # Create an opaque pointer type to mask the raw AEDesc pointers we'll throw around | |
| AEDescRef = objc.createOpaquePointerType('AEDescRef', '^{AEDesc=I^^{OpaqueAEDataStorageType}}') |
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
| ''' | |
| This is an example of the server-side logic to handle slash commands in | |
| Python with Flask. | |
| Detailed documentation of Slack slash commands: | |
| https://api.slack.com/slash-commands | |
| Slash commands style guide: | |
| https://medium.com/slack-developer-blog/slash-commands-style-guide-4e91272aa43a#.6zmti394c | |
| ''' |