Skip to content

Instantly share code, notes, and snippets.

@rtrouton
rtrouton / java_plugin_vendor
Created Oct 31, 2012
OS X Java vendor Extension attribute
View java_plugin_vendor
#!/bin/sh
javaVendor=`defaults read /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Info CFBundleIdentifier`
if [ "$javaVendor" = "com.oracle.java.JavaAppletPlugin" ]; then
result=Oracle
elif [ "$javaVendor" = "com.apple.java.JavaAppletPlugin" ]; then
result=Apple
elif [ "$javaVendor" = "" ]; then
result="No Java Plug-In Available"
View gist:4566986
#!/bin/tcsh -f
##
############################ login.sh ###########################
# Mike Bombich | mike@bombich.com
# Copyright 2002 Mike Bombich.
# With the appropriate modification to /etc/ttys, this script will
# execute each time a user logs in.
##################################################################
# This script takes the username as an argument, then removes any
@rtrouton
rtrouton / gist:5303232
Created Apr 3, 2013
MCX debug reporting script
View gist:5303232
#!/bin/sh
PATH=/bin:/usr/bin:/sbin:/usr/sbin export PATH
# Define the recipient.
RECIP="email@address.here"
# That should be it for the necessary configuration part. The rest can be pretty much as-is.
NAME=`hostname`
LOGS="/tmp/tomcat-restart.txt"
HWLOGDATE=$(printf "`date "+%a %h %e"` \n")
@rtrouton
rtrouton / gist:5415881
Created Apr 18, 2013
Adding two websites to Safari's Java whitelist in your Mac's default user template and for all existing users
View gist:5415881
#!/bin/sh
# Adding two websites to Safari's Java whitelist in your Mac's default user template and for all existing users.
# Code adapted from DeployStudio's rc130 ds_finalize script, from the section where DeployStudio is disabling the iCloud and gestures demos
# Get today's date
TODAY=$(date "+%FT%TZ")
# Checks first to see if the Mac is running defaults10.6 or higher.
@rtrouton
rtrouton / XProtect re-enable Java 6 and 7
Created May 11, 2013
This script will check the current Java 6 and Java 7 browser plug-in versions and compare them against the minimum version allowed by Apple's XProtect malware protection. If the minimum Java version allowed by XProtect does not allow the current version of the Java browser plug-in on the Mac, the script will alter the Mac's /System/Library/CoreS…
View XProtect re-enable Java 6 and 7
#!/bin/sh
# This script will check the current Java 6 and Java 7 browser plug-in
# versions and compare them against the minimum version allowed by
# Apple's XProtect malware protection. If the minimum Java version
# allowed by XProtect does not allow the current version of the Java
# browser plug-in on the Mac, the script will alter the Mac's
# /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/XProtect.meta.plist
# file to set the minimum version allowed to match the current version
# of the Mac's Java browser plug-in. This allows the Mac's current Java
@rtrouton
rtrouton / gist:5592303
Created May 16, 2013
This is an AppleScript used to look up Active Directory home directory locations. Assumptions: In order to work correctly, the script needs for the Mac to be bound to an AD domain. The AD-bound Mac also needs to be connected to the AD domain via a domain-reachable network connection or via VPN. Using the script: Launch the script and provide the…
View gist:5592303
-- Look up AD home directory script
-- Peter Bukowinski
-- Rich Trouton
-- this repeat loop prevents empty strings from being submitted
set q to 0
repeat while q is 0
set result to text returned of (display dialog "Enter the Username whose home folder you want to look up:" default answer "")
if result is not "" then
set userName to result
@rtrouton
rtrouton / gist:5843570
Last active Dec 18, 2015
This Casper Extension Attribute determines if either of the the following Java builds are installed: 10.6.x: 1.6.0_51-b11-456-10M4508 10.7.x - 10.8.x: 1.6.0_51-b11-456-11M4508 These builds were installed by the first versions of Java for OS X 2013-004 and Java for Mac OS X 10.6 Update 16 and can cause problems for Java Swing applications like MA…
View gist:5843570
#!/bin/sh
# Determines if either of the following
# Java builds are installed:
#
# 10.6.x: 1.6.0_51-b11-456-10M4508
# 10.7.x - 10.8.x: 1.6.0_51-b11-456-11M4508
#
# This builds were installed by the first versions of
# Java for OS X 2013-004 and Java for Mac OS X 10.6 Update 16
@rtrouton
rtrouton / gist:5852198
Last active Dec 18, 2015
Using the JAVA_INSTALL_ON_DEMAND environment variable to force Macs running 10.7.x or 10.8.x to reinstall the latest Java update.
View gist:5852198
#!/bin/bash
# Original version of this script posted by
# Michael Kuron <michael-lists@PHYSCIP.UNI-STUTTGART.DE>
# Posted to the MacEnterprise list on June 22, 2013:
# http://tinyurl.com/m8fp4ou
#
# This script works on Mac OS X 10.7.0 and higher
#
@rtrouton
rtrouton / gist:6031323
Created Jul 18, 2013
Downloading gzip'd tar file from web server to update NFS automounts
View gist:6031323
#!/bin/bash
# This script checks the timestamp of the fileURL and compares it against a locally
# cached timestamp. If the archive's timestamp is newer, then it gets downloaded,
# extracted into /etc/, and the automount cache gets flushed.
fileURL="http://server.name.here/path/to/automounts.tgz"
sleep 20
@rtrouton
rtrouton / gist:6134929
Last active Dec 20, 2015
This script below prepares a customized OS X installer disk image for use with VMware Fusion. It's adapted from the prepare_iso script created by Tim Sutton: https://github.com/timsutton/osx-vm-templates/tree/master/prepare_iso For proper functioning, this script needs an associated support directory. Details here: https://github.com/rtrouton/rt…
View gist:6134929
#!/bin/sh
#
# Preparation script for a customized OS X installer for use with VWware Fusion
#
# 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