Skip to content

Instantly share code, notes, and snippets.

<key>_autopromotion_data<key>
<dict>
<key>2014-05-30</key>
<array>
<string>testing</string>
</array>
<key>2014-06-07<key>
<array>
<string>production</string>
</array>
<key>_autopromotion_data<key>
<dict>
<key>4</key>
<array>
<string>testing</string>
</array>
<key>11<key>
<array>
<string>production</string>
</array>
@gregneagle
gregneagle / Firefox-29.0.plist
Last active August 29, 2015 14:01
P-O-C makecatalogs with support for autopromotion
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>_autopromotion_catalogs</key>
<dict>
<key>7</key>
<array>
<string>production</string>
<string>firefox-testing</string>
import subprocess
output = subprocess.check_output(['/usr/bin/profiles', '-C'])
for line in output.splitlines():
(stuff, label, profile_identifier) = line.partition(' profileIdentifier: ')
if label and profile_identifer.startswith('com.apple.mdm.mdm.educ.psu.edu'):
print profile_identifier
import urllib2
url = 'http://www.macbartender.com/updates/Appcast.xml'
request = urllib2.Request(url=url)
request.add_header('user-agent', 'Mozilla/5.0')
url_handle = urllib2.urlopen(request)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>CalDAVAccountDescription</key>
<string>My Organization</string>
<key>CalDAVHostName</key>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Description</key>
<string>Downloads and imports Munki 2 tools. Gets the latest build from https://munkibuilds.org/munkitools2-latest.pkg</string>
<key>Identifier</key>
<string>com.foo.autopkg.munki.munkitools2</string>
<key>Input</key>
<dict>
#!/usr/bin/python
"""
Programmatically altering plists with Python, shooting to add support to ansible
"""
import optparse
import FoundationPlist
# from munkilib import FoundationPlist
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> a = "AdobeDreamweaverCS5.5.png"
>>> import os
>>> os.path.splitext(a)[1]
'.png'
>>> os.path.splitext(a)[0]
'AdobeDreamweaverCS5.5'
@gregneagle
gregneagle / gist:60ce73c7e267d993f1c1
Created August 13, 2014 17:23
Using the SystemConfiguration framework via PyObjC to get "ComputerName"
import SystemConfiguration
prefs = SystemConfiguration.SCPreferencesCreate(None, "SystemConfiguration", None)
print SystemConfiguration.SCPreferencesGetValue(prefs, "System")["System"]["ComputerName"]