Skip to content

Instantly share code, notes, and snippets.

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)
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
@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>
<key>_autopromotion_data<key>
<dict>
<key>4</key>
<array>
<string>testing</string>
</array>
<key>11<key>
<array>
<string>production</string>
</array>
<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>
% autopkg info Firefox_RC.munki
Description: Downloads Firefox disk image and imports into Munki.
Values for FIREFOX_BUILD correspond to directories here: http://download-origin.cdn.mozilla.net/pub/mozilla.org/firefox/releases/
Some useful values are: 'latest', 'latest-10.0esr', 'latest-esr', 'latest-3.6', 'latest-beta'
LOCALE corresponds to directories at http://download-origin.cdn.mozilla.net/pub/mozilla.org/firefox/releases/$FIREFOX_BUILD/mac/
Examples include 'en-US', 'de', 'ja-JP-mac', 'sv-SE', and 'zh-TW'
No idea if all Firefox builds are available in all the same localizations, so you may need to verify that any particular
combination is offered.
Identifier: com.disneyanimation.firefox-RC
Munki import recipe: True
<key>Input</key>
<dict>
<key>NAME</key>
<string>Adium</string>
<key>MUNKI_REPO_SUBDIR</key>
<string>apps</string>
<key>pkginfo</key>
<dict>
<key>catalogs</key>
<array>
@gregneagle
gregneagle / finish_jenkins_autopkg_run.py
Created January 3, 2014 19:00
Some scripts from my MacSysAdmin 2013 demo
#!/usr/bin/env python
# encoding: utf-8
"""
finish_jenkins_autopkg_run.py
Created by Greg Neagle on 2013-08-23.
"""
import os
import plistlib
@gregneagle
gregneagle / gurl.py
Last active December 28, 2015 22:29
# http://httpstat.us - for test error codes
# http://uri-labs.com/macosx_headers/NSURLConnection_h/Protocols/NSURLConnectionDelegate/index.html
# Notes:
# - Errors are only thrown when the connection:
# - Is interrupted before the headers can complete
# - SSL couldn't happen correctly
# - The connection never happens
# - A delegate.response always has a NSHTTPURLResponse key for HTTP/HTTPS
# For a file:// transfer, it's NSURLResponse
import httplib
import re
import socket
import sys
import urllib2
import ssl
class InvalidCertificateException(httplib.HTTPException, urllib2.URLError):
def __init__(self, host, cert, reason):
httplib.HTTPException.__init__(self)