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
$ ./make_relocatable_python_framework.py --python-version 3.8.5 | |
Downloading https://www.python.org/ftp/python/3.8.5/python-3.8.5-macosx10.9.pkg... | |
% Total % Received % Xferd Average Speed Time Time Time Current | |
Dload Upload Total Spent Left Speed | |
100 28.8M 100 28.8M 0 0 6860k 0 0:00:04 0:00:04 --:--:-- 6860k | |
Expanding /var/folders/tc/sd4_mtvj14jdy7cg21m2gmcw000495/T/tmpdhiqv6m3... | |
Extracting /var/folders/tc/sd4_mtvj14jdy7cg21m2gmcw000495/T/tmpdhiqv6m3__expanded__/Python_Framework.pkg/Payload to ./Python.framework... | |
Ensuring correct modes for files in /Users/Shared/relocatable-python/Python.framework... | |
Analyzing /Users/Shared/relocatable-python/Python.framework... | |
............................... |
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
from Foundation import NSObject, NSUserDefaults, NSKeyValueObservingOptionNew | |
from Foundation import NSRunLoop, NSDate | |
class PrefsObserver(NSObject): | |
def observe(self, domain, key): | |
self.domain = domain | |
self.key = key | |
if self: | |
self.defaults = NSUserDefaults.alloc().initWithSuiteName_( |
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
from munkilib import gurl | |
def run_connection(options): | |
connection = gurl.Gurl.alloc().initWithOptions_(options) | |
percent_complete = -1 | |
bytes_received = 0 | |
connection.start() | |
try: | |
while not connection.isDone(): | |
if connection.destination_path: |
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
% python | |
Python 2.7.6 (default, Sep 9 2014, 15:04:36) | |
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> os_vers_1 = "10.9.5" | |
>>> os_vers_2 = "10.10" | |
>>> os_vers_2 > os_vers_1 | |
False | |
>>> from distutils import version | |
>>> version.LooseVersion(os_vers_2) > version.LooseVersion(os_vers_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 | |
import os | |
import pwd | |
from Foundation import CFPreferencesAppSynchronize | |
from Foundation import CFPreferencesSetValue | |
from Foundation import kCFPreferencesCurrentUser | |
from Foundation import kCFPreferencesCurrentHost |
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 | |
# encoding: utf-8 | |
# | |
# Copyright 2009-2016 Greg Neagle. | |
# | |
# Licensed under the Apache License, Version 2.0 (the 'License'); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.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 os | |
import subprocess | |
import sqlite3 | |
desktop_picture_path = '/Library/Desktop Pictures/Wave.jpg' | |
database_location = os.path.expanduser( | |
'~/Library/Application Support/Dock/desktoppicture.db') |
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 time | |
from Quartz import CGGetActiveDisplayList, CGGetOnlineDisplayList | |
from CoreFoundation import CFPreferencesCopyAppValue | |
def displayMirroringActive(): | |
'''Returns True if any two displays are mirroring, False otherwise''' |
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
import CoreFoundation | |
from Foundation import NSDate | |
# read Safari's current ManagedPlugInPolicies | |
policy = CoreFoundation.CFPreferencesCopyAppValue( | |
'ManagedPlugInPolicies', 'com.apple.Safari') | |
if not 'com.oracle.java.JavaAppletPlugin' in policy: | |
# create an empty dict | |
policy['com.oracle.java.JavaAppletPlugin'] = {} |
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
<dict> | |
<key>PayloadContent</key> | |
<dict> | |
<key>com.apple.mcxMenuExtras</key> | |
<dict> | |
<key>Forced</key> | |
<array> | |
<dict> | |
<key>mcx_preference_settings</key> | |
<dict> |