Skip to content

Instantly share code, notes, and snippets.

@rtrouton
rtrouton / gist:ac00982e06440407e558
Created February 25, 2015 17:59
Postinstall script for Sophos Enterprise Anti-Virus for Mac OS X 9.2.x installer
#!/bin/bash
LOGGER="/usr/bin/logger"
FILE_DATE=`date +%Y%m%d%H%M%S`
# Determine working directory
install_dir=`dirname $0`
# Location of Sophos keychain file
@rtrouton
rtrouton / gist:7111637
Last active January 11, 2017 13:48
Updated create_vmware_osx_install_dmg.sh now includes support for Mavericks.
#!/bin/sh
#
# Preparation script for a customized OS X installer for use with VWware Fusion and ESXi
#
# What the script does, in more detail:
#
# 1. Mounts the InstallESD.dmg using a shadow file, so the original DMG is left
# unchanged.
# 2. minstallconfig.xml is also copied, which is looked for by the installer environment's
# rc.* files that first load with the system. This allows us to never actually modify the
@rtrouton
rtrouton / gist:c09f8ed541d330c4c7d4
Last active January 10, 2017 21:43
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
@rtrouton
rtrouton / gist:49101bfe86a6833fb38a
Last active November 30, 2016 05:00
Reading Apple JDK version number
java -version 2>&1 | awk 'NR==1{ gsub(/"/,""); print $3 }'
@rtrouton
rtrouton / LSbootstrapper.py
Created August 28, 2016 19:27 — forked from arubdesu/LSbootstrapper.py
For running at first boot, to enable both location services and whitelist Maps and AutoTimeZone('based on current location')
#!/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 August 26, 2016 16:07 — forked from pudquick/autotimezone.py
Forcing automatic timezone discovery with pyobjc on OS X
# 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 21:23
Python script to generate list of enabled and disabled policies
#!/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 April 14, 2016 14:44
Using BTSync for Casper Replicates
https://docs.google.com/document/d/1wdtJO9TaRn_aGAYCyUizuydWsVVTncx3Ey2V66sjRwI/edit
@rtrouton
rtrouton / gist:df581567dbeb2e454611
Last active January 21, 2016 14:07
Setting whether you want to send diagnostic info from Yosemite and later back to Apple and/or third party app developers by setting the appropriate values in /Library/Application Support/CrashReporter/DiagnosticMessagesHistory.plist
#!/bin/bash
# Determine OS version
osvers=$(sw_vers -productVersion | awk -F. '{print $2}')
# Set whether you want to send diagnostic info back to
# Apple and/or third party app developers. If you want
# to send diagonostic data to Apple, set the following
# value for the SUBMIT_DIAGNOSTIC_DATA_TO_APPLE value:
#
@rtrouton
rtrouton / cipher.sh
Last active January 14, 2016 20:45 — forked from opragel/cipher.sh
#!/bin/bash
# Add the user and group used by Tomcat on your Linux
# server. For Casper 9.x running on Red Hat Enterprise
# Linux, the user and group are filled in below.
linux_tomcat_user="tomcat7"
linux_tomcat_group="tomcat7"
# Add the user and group used by Tomcat on your Linux