Skip to content

Instantly share code, notes, and snippets.

@rtrouton
rtrouton / gist:04b6c31762b84b85eb44d0c59d8e1cd2
Created Aug 30, 2016
Mac models not compatible with macOS Sierra
View gist:04b6c31762b84b85eb44d0c59d8e1cd2
'MacBookPro4,1'
'MacPro2,1'
'MacBookPro5,1'
'MacBookPro1,1'
'MacBookPro5,3'
'MacBookPro5,2'
'iMac8,1'
'MacBookPro5,4'
'iMac5,1'
'iMac5,2'
@rtrouton
rtrouton / gist:e6cf0f4064aea52fac2e5116c4b05f2e
Created Aug 30, 2016
Sierra compatible Macs, sorted by Model ID and board ID
View gist:e6cf0f4064aea52fac2e5116c4b05f2e
MacBook9,1: 'Mac-9AE82516C7C6B903'
iMac14,1: 'Mac-031B6874CF7F642A'
iMac10,1: 'Mac-F2268DC8'
MacBookPro8,1: 'Mac-50619A408DB004DA'
MacBook6,1: 'Mac-F22C8AC8'
MacBookPro10,2: 'Mac-AFD8A9D944EA4843'
iMac12,2: 'Mac-942B59F58194171B'
iMac14,2: 'Mac-27ADBB7B4CEE8E61'
MacBook8,2: 'Mac-F305150B0C7DEEEF'
MacBookAir6,1: 'Mac-35C1E88140C3E6CF'
@rtrouton
rtrouton / LSbootstrapper.py
Created Aug 28, 2016 — forked from arubdesu/LSbootstrapper.py
For running at first boot, to enable both location services and whitelist Maps and AutoTimeZone('based on current location')
View LSbootstrapper.py
#!/usr/bin/python
"""Enables location services, allows Maps and Timezone"""
import os
import platform
import subprocess
import sys
try:
sys.path.append('/usr/local/munki/munkilib/')
import FoundationPlist
except ImportError as error:
@rtrouton
rtrouton / autotimezone.py
Created Aug 26, 2016 — forked from pudquick/autotimezone.py
Forcing automatic timezone discovery with pyobjc on OS X
View autotimezone.py
# Tested on 10.11
# Assumes your network is in a state to actually do the discovery
# (Generally this means wifi enabled on your device and network stack is up)
#
# Note: When this code exits, it will generate an error message - this is to be expected!
# Error will look like:
# Python[3056:158489] PyObjC: Exception during dealloc of proxy: Cannot remove an observer <TimeZonePref 0x7f846b4b6710>
# for the key path "enabled" from <ATZAdminPrefererences 0x7f846b502a30> because it is not registered as an observer.
#
# This is because we're cheating with the initialization of a TimeZonePref class to get cheap access to
@rtrouton
rtrouton / jss_policies_report.py
Last active May 3, 2016
Python script to generate list of enabled and disabled policies
View jss_policies_report.py
#!/usr/bin/env python
import base64
import getpass
import sys
import xml.etree.ElementTree as Et
import urllib
import urllib2
reload(sys)
@rtrouton
rtrouton / gist:86f210edc29f700c000b8fc82b936b92
Created Apr 14, 2016
Using BTSync for Casper Replicates
View gist:86f210edc29f700c000b8fc82b936b92
https://docs.google.com/document/d/1wdtJO9TaRn_aGAYCyUizuydWsVVTncx3Ey2V66sjRwI/edit
@rtrouton
rtrouton / filevault2_api.py
Created Jan 2, 2016 — forked from pudquick/filevault2_api.py
Programmatic access to usernames, icons, encryption status, and more for FileVault2 for OS X
View filevault2_api.py
# This code must run as root
# We're mixing ObjC and C-style dylibs, so this is really fun
# The only reason we're doing this is that the OS is _really really_ picky about trying to do
# ANYTHING with the CoreStorage Family Properties CFDictionary that's in-memory EXCEPT for
# making a mutable copy of it.
# Once we've done that, we can bring it into pyObjC to play nicely with the data.
import objc
View gist:fd965b16a9b4a7dc5d89
#!/bin/bash
# Identify location of jamf binary.
jamf_binary=`/usr/bin/which jamf`
if [[ "$jamf_binary" == "" ]] && [[ -e "/usr/sbin/jamf" ]] && [[ ! -e "/usr/local/bin/jamf" ]]; then
jamf_binary="/usr/sbin/jamf"
elif [[ "$jamf_binary" == "" ]] && [[ ! -e "/usr/sbin/jamf" ]] && [[ -e "/usr/local/bin/jamf" ]]; then
jamf_binary="/usr/local/bin/jamf"
@rtrouton
rtrouton / gist:c05b545d3406de3ca290
Created Dec 13, 2015
One-liner for capturing and formatting the output of top on OS X, then exporting to a /tmp/top-output.txt file
View gist:c05b545d3406de3ca290
/usr/bin/top -l 1 > /tmp/top-scratch.txt && less /tmp/top-scratch.txt >> /tmp/top-output.txt && /bin/rm /tmp/top-scratch.txt
@rtrouton
rtrouton / gist:c09f8ed541d330c4c7d4
Last active Jan 10, 2017
Automated setup script for OS X Server 5.0.x and later
View gist:c09f8ed541d330c4c7d4
#!/bin/bash
# This script is designed to automate the setup of OS X Server 5.0.3 and later
# by authorizing and using the 'server' tool within /Applications/Server.app to
# run the initial setup and configuration of OS X Server's services.
# Script will check for the existence of the 'server' setup tool. If the 'server' setup tool
# is not located where the script expects it to be, the script will exit.
if [[ ! -e "/Applications/Server.app/Contents/ServerRoot/usr/sbin/server" ]]; then