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
# Backup destination details are stored in: /Library/Preferences/com.apple.TimeMachine.plist | |
# 10.11 | |
from Foundation import NSBundle | |
TMMenu = NSBundle.bundleWithPath_('/System/Library/CoreServices/Menu Extras/TimeMachine.menu') | |
AppleTMSettings = TMMenu.classNamed_('AppleTMSettings') | |
settings = AppleTMSettings.sharedSettings() | |
# @interface AppleTMSettings : NSObject |
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
# Tested on 10.11 | |
# Note: | |
# The marketing information embedded in the ServerInformation.framework is not the same as what | |
# About This Mac displays - there are differences. | |
# | |
# For example: | |
# ServerInformation: 15" MacBook Pro with Retina display (Mid 2015) | |
# About This Mac: MacBook Pro (Retina, 15-inch, Mid 2015) | |
# |
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 | |
packagekit_bundle = objc.loadBundle('PackageKit', module_globals=globals(), bundle_path='/System/Library/PrivateFrameworks/PackageKit.framework', scan_classes=False) | |
PKReceipt = objc.lookUpClass('PKReceipt') | |
receipts = PKReceipt.receiptsOnVolumeAtPath_('/') | |
first_receipt = receipts[0] | |
# Things you can look up: | |
# installPrefixPath |
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 | |
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) | |
return buf.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
import posixpath, urlparse, urllib2, re, ast, struct, cmd, os, os.path | |
import xml.etree.ElementTree as ET | |
def discover_roms(rom_url): | |
# step 1: based on the URL, download the _files.xml for the details | |
# I could do this a lot easier, but this is more fun | |
url_parts = urlparse.urlsplit(rom_url) | |
base_path, page_path = posixpath.split(url_parts.path) | |
files_path = posixpath.join(url_parts.path, page_path + '_files.xml') | |
new_parts = url_parts._replace(path=files_path) |
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 | |
# Predefine some opaque types | |
DASessionRef = objc.createOpaquePointerType('DASessionRef', b'^{__DASession=}', None) | |
DADiskRef = objc.createOpaquePointerType('DADiskRef', b'^{__DADisk=}', None) | |
# Load DiskManagement framework classes | |
DiskManagment = objc.loadBundle('DiskManagment', globals(), bundle_path='/System/Library/PrivateFrameworks/DiskManagement.framework') |
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, Structure, POINTER, c_void_p, byref | |
from ctypes.util import find_library | |
import objc | |
PrintCore = CDLL('/System/Library/Frameworks/ApplicationServices.framework/Frameworks/PrintCore.framework/PrintCore') | |
CFoundation = CDLL(find_library('CoreFoundation')) | |
class OpaqueType(Structure): | |
pass |
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
# OFFICIAL REPO: https://github.com/pudquick/nibbler | |
# (this gist will be preserved for historical purposes) | |
# demo video here: | |
# https://www.dropbox.com/s/k0bpekd13muknmz/nibbler%20-%20by%20frogor.mp4?dl=0 | |
# Example script using nibbler: | |
# from nibbler import * | |
# |
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 argparse, sys, os.path, subprocess, shlex, re, os | |
# MacDevOpsYVR 2015 presentation saver | |
# NOTE: | |
# The backup edits the main html page to preserve only HTML5 presentation mode (no Silverlight, etc. | |
# components are downloaded by this backup script). | |
# | |
# IMPORTANT! |
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/env python3 | |
import os, os.path, json, hashlib, subprocess, argparse, sys, stat | |
BUFFER_SIZE = 65536 | |
def checksum_directory(source_path, progress=False): | |
filesystem_details = dict() | |
# rough guess of how many files are in a directory | |
# horrible hack with a little fudge | |
if not os.path.isdir(source_path): |