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 / munki_fuzzinator.py
Created October 9, 2015 22:01 — forked from bruienne/munki_fuzzinator.py
Simple makecatalogs-based script to perform some level of Munki-specific linting on pkginfo files
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright 2014 - The Regents of the University of Michigan.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@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>
@erikng
erikng / get_platform.py
Created February 9, 2016 16:37 — forked from pudquick/get_platform.py
Get Mac's serial number and hardware UUID via python
import objc
from Foundation import NSBundle
IOKit_bundle = NSBundle.bundleWithIdentifier_('com.apple.framework.IOKit')
functions = [("IOServiceGetMatchingService", b"II@"),
("IOServiceMatching", b"@*"),
("IORegistryEntryCreateCFProperty", b"@I@@I"),
]
#!/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