Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
import plistlib, os.path, os
# Based off of https://forums.developer.apple.com/message/6741
# and http://apple.stackexchange.com/a/136976
def jdk_info_plists():
# Find all the JDK Info.plist files
JDK_ROOT = "/Library/Java/JavaVirtualMachines"
if (os.path.exists(JDK_ROOT) and os.path.isdir(JDK_ROOT)):
@erikng
erikng / z-automator.png
Last active August 31, 2015 20:16 — forked from lrytz/z-automator.png
Shortcut for Syntax Highlighting in Keynote
@erikng
erikng / pyCacher.py
Last active September 18, 2015 16:09 — forked from pudquick/pyCacher.py
Playing with parsing Server caching service logs
import tempfile, os.path, shutil, glob, os, subprocess, re
debug = True
# It should take the logs from tmp and clone them somewhere
# It can then bunzip and combine them
def log(s):
global debug
if debug:
print s
@erikng
erikng / accept_xcode_license.sh
Created October 26, 2015 14:27 — forked from ryanmaclean/accept_xcode_license.sh
Accept Xcode License on the Command Line
# Run using "sudo accept_xcode_license.sh"
#
# Solving the OSX Yosemite Xcode Command Line Tools Licensing problem
# for multiple updates in order to script post-install tasks.
# Typical error reads after running "xcode-select --install" when setting up
# Homebrew is: "Agreeing to the Xcode/iOS license requires admin priviledges,
# please re-run as root via sudo"
#
# CREDIT:
# Based on a tip found at http://krypted.com/mac-os-x/licensing-the-xcode-command-line-tools/
@erikng
erikng / gist:9b244cf1805c052d3533
Created December 23, 2015 04:24 — forked from rtrouton/gist:c09f8ed541d330c4c7d4
Automated setup script for OS X Server 5.0.x and later
#!/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
@erikng
erikng / installer_choices_xml.plist
Created December 23, 2015 04:28 — forked from timsutton/installer_choices_xml.plist
Office 2016 workarounds for MAU and the AU Daemon
<!-- This can be added to a Munki pkginfo so as to deselect the MAU component
from being installed. However, some version of MAU would be probably
already installed if Office 2011 had ever been installed on this system. -->
<key>installer_choices_xml</key>
<array>
<dict>
<key>attributeSetting</key>
<integer>0</integer>
<key>choiceAttribute</key>
<string>selected</string>
#!/usr/bin/env python
# To look at: https://github.com/kcrawford/mac-network/blob/master/lib/mac-network/wifi.rb
# To look at: https://stackoverflow.com/questions/28096630/mac-os-x-10-10-reorder-preferred-networks
'''
Playing around with CoreWLAN to return information about the wi-fi connection
Documentation:
https://developer.apple.com/library/mac/documentation/CoreWLAN/Reference/CWInterface_reference/translated_content/CWInterface.html
@erikng
erikng / bootstrap.py
Created July 12, 2016 16:19 — forked from nmcspadden/bootstrap.py
Bootstrap Chef
#!/usr/bin/python
"""Bootstrap Chef with no other dependencies."""
import os
import sys
import platform
import subprocess
import json
import plistlib
import urllib2
@erikng
erikng / 8021x_inspect.py
Created July 19, 2016 22:27 — forked from pudquick/8021x_inspect.py
802.1x configuration / data collection on OS X using python and the PrivateFramework "EAP8021X.framework"
# This was all run from user space
# I haven't tested it with root
# ... but it didn't prompt for any permissions under userspace ^_^
# Tested on 10.11.5
import objc
from Foundation import NSBundle
EAP8021X_bundle = NSBundle.bundleWithPath_('/System/Library/PrivateFrameworks/EAP8021X.framework')
Security_bundle = NSBundle.bundleWithIdentifier_('com.apple.security')
@erikng
erikng / marketing.py
Created August 25, 2016 03:52 — forked from pudquick/marketing.py
Using PrivateFrameworks to get marketing model information for Apple Macs without hitting their internet API (where possible) via python and pyobjc
# Tested on 10.11
# Note:
# The marketing information embedded in the ServerInformation.framework is not the same as what
# About This Mac displays - there are differences.
#
# For example:
# ServerInformation: 15" MacBook Pro with Retina display (Mid 2015)
# About This Mac: MacBook Pro (Retina, 15-inch, Mid 2015)
#