Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
# I got the meat of this script from somewhere but I can't remember where...
# if it was yours, let me know and I'll give credit.
'''
download macsysadmin videos
requires:
{
"output_name": "macos-netboot",
"bridged": true,
"netboot": true,
"netboot_hdsize": 60,
"netboot_osvers": "10.12"
}
@chilcote
chilcote / check-10.12-sierra-compatibility
Created September 10, 2016 01:16
Check 10.12 Sierra Compatibility EA
#!/usr/bin/env python
# encoding: utf-8
# ================================================================================
# check-1012-sierra-compatibility.py
#
# This script checks if the current system is compatible with macOS 10.12 Sierra.
# These checks are based on the installCheckScript and volCheckScript in
# distribution file of OSInstall.mpkg installer package. The OSInstall.mpkg can be
# found in the root of InstallESD disk image.
#disable icloud prompts
osvers_major=$(sw_vers -productVersion | awk -F. '{print $1}')
osvers_minor=$(sw_vers -productVersion | awk -F. '{print $2}')
/usr/bin/defaults write /System/Library/User\ Template/English.lproj/Library/Preferences/com.apple.SetupAssistant DidSeeCloudSetup -bool true
/usr/bin/defaults write /System/Library/User\ Template/English.lproj/Library/Preferences/com.apple.SetupAssistant GestureMovieSeen none
/usr/bin/defaults write /System/Library/User\ Template/English.lproj/Library/Preferences/com.apple.SetupAssistant LastSeenCloudProductVersion ${osvers_major}.${osvers_minor}
@chilcote
chilcote / gist:6649e2867e1a547f4a06
Created October 11, 2015 18:58
Get primary interface name and IP
#!/usr/bin/python
from SystemConfiguration import SCDynamicStoreCreate, SCDynamicStoreCopyValue
net_config = SCDynamicStoreCreate(None, "net", None, None)
def get_primaryinterface():
states = SCDynamicStoreCopyValue(net_config, "State:/Network/Global/IPv4")
return states['PrimaryInterface']
#!/bin/sh
while [ ${SECONDS} -le 10 ]; do
if [ "$(scutil -r dc.yourdomain.com)" = "Reachable" ]; then
echo yep
break
fi
done
@chilcote
chilcote / Makefile
Created November 25, 2010 23:35
example Makefile for packaging Firefox with custom settings
include /usr/local/share/luggage/luggage.make
TITLE=app_firefox
REVERSE_DOMAIN=com.example.corp
PAYLOAD=unbz2-applications-firefox.app \
pack-firefox-settings-local-settings.js \
pack-firefox-settings-firefox_AA.cfg \
pack-firefox-settings-override.ini
unbz2-applications-firefox.app: firefox.app.tar.bz2 l_Applications
@sudo ${TAR} xjf firefox.app.tar.bz2 -C ${WORK_D}/Applications
@chilcote
chilcote / gist:4abf81a0be65a675e7c2
Created July 9, 2015 15:34
osquery vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "osx104"
config.vm.synced_folder "./data", "/vagrant_data"
config.vm.provision "shell", inline: <<-SHELL
curl -s -O "https://osquery-packages.s3.amazonaws.com/darwin/osquery-1.4.5.pkg"
installer -pkg osquery-1.4.5.pkg -target /
SHELL
@chilcote
chilcote / gist:3314df7316a967f054cd
Created July 9, 2015 15:07
Vagrantfile to pull softwareupdate -l output
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "osx103"
config.vm.provision "shell", inline: <<-SHELL
softwareupdate -l
SHELL
end
#!/usr/bin/env python
'''
This script returns the version of the specified Application
usage:
./pyappvers.py "VMware Fusion"
Documentation:
https://developer.apple.com/library/mac/documentation/CoreFoundation/Reference/CFPreferencesUtils/Reference/reference.html