Skip to content

Instantly share code, notes, and snippets.

{
AppleSoftwareUpdatesOnly = 0;
ClientIdentifier = "";
LastCheckDate = "2014-03-18 20:50:21 +0000";
LastCheckResult = 1;
LogFile = "/Library/Managed Installs/Logs/ManagedSoftwareUpdate.log";
LoggingLevel = 1;
ManagedInstallDir = "/Library/Managed Installs";
PackageVerificationMode = hash;
SoftwareRepoURL = "https://munki.grahamgilbert.com/repo";
@grahamgilbert
grahamgilbert / boot_rom_version.py
Created March 5, 2015 20:49
boot_rom_version.py
#!/usr/bin/python
# Written in 10 minutes and tested on 10.10.2 only. Use with caution.
import subprocess
import plistlib
import os
from Foundation import CFPreferencesCopyAppValue
def boot_rom_version():
#!/usr/bin/python
import os
import subprocess
import urllib
import urllib2
import tempfile
import json
import shutil
from time import localtime
<?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>PayloadType</key>
<string>com.apple.applicationaccess.new</string>
<key>PayloadVersion</key>
@grahamgilbert
grahamgilbert / frontapp.py
Created January 5, 2016 14:38
Script that will check if an app has been inactive for five minutes and quits if needed
#!/usr/bin/python
""" Graham Gilbert 5/1/16
Change TARGET_APP and the app name on line 53 to your chosen app to quit.
Run this as often as you'd like via a launchagent.
No warranty expressed or implied. If things go kaboom, it's your problem!
"""
from AppKit import NSWorkspace
<?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>RestartAction</key>
<string>RequireRestart</string>
<key>_metadata</key>
<dict>
<key>created_by</key>
<string>grahamgilbert</string>
@grahamgilbert
grahamgilbert / autotimezone.sh
Created August 3, 2016 06:23
Enable Auto TimeZone
#!/bin/bash
/bin/launchctl unload /System/Library/LaunchDaemons/com.apple.locationd.plist
uuid=`/usr/sbin/system_profiler SPHardwareDataType | grep "Hardware UUID" | cut -c22-57`
/usr/bin/defaults write /var/db/locationd/Library/Preferences/ByHost/com.apple.locationd.$uuid LocationServicesEnabled -int 1
/usr/sbin/chown -R _locationd:_locationd /var/db/locationd
/bin/launchctl load /System/Library/LaunchDaemons/com.apple.locationd.plist
/usr/sbin/systemsetup -setusingnetworktime on
@grahamgilbert
grahamgilbert / base64_plist.py
Created September 5, 2016 11:03
Writing a base64 encoded string into a plist
#!/usr/bin/python
import base64
import plistlib
import errno
import os
def mkdir_p(path):
try:
os.makedirs(path)
@grahamgilbert
grahamgilbert / API.md
Created June 24, 2017 15:44
Proposed changes to the API docs

Sal has a REST API. You will need to create an API key before using it. You should send your private key and public key as headers (publickey and privatekey). Some actions can only be performed by API keys that have been marked as read / write in Sal.

General notes

Sal's API will generally return a response similar to the following:

{"count":362,"next":"https://sal.example.com/api/conditions/?condition=machine_type&page=2","previous":null,"results":[...]}