Skip to content

Instantly share code, notes, and snippets.

View bruienne's full-sized avatar

Pepijn Bruienne bruienne

View GitHub Profile
@bruienne
bruienne / gist:5066890
Last active December 14, 2015 09:39
Set Flash plugin minimum version to currently installed version while evaluating Xprotect.meta.plist changes. Note $3 entries for easy use in a payload-free package.
#!/bin/bash
function version { echo "$@" | awk -F. '{ printf("%d.%d.%d.%d\n", $1,$2,$3,$4); }'; }
if [[ -e "$3/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/XProtect.meta.plist" ]]; then
CURRENT_FLASH_BUILD=`/usr/libexec/PlistBuddy -c "print :CFBundleShortVersionString" "$3/Library/Internet Plug-Ins/Flash Player.plugin/Contents/Info.plist"`
XPROTECT_FLASH_BUILD=`/usr/libexec/PlistBuddy -c "print :PlugInBlacklist:10:'com.macromedia.Flash Player.plugin':MinimumPlugInBundleVersion" "$3/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/XProtect.meta.plist"`
if [[ $(version ${CURRENT_FLASH_BUILD}) < $(version ${XPROTECT_FLASH_BUILD}) ]]; then
@bruienne
bruienne / vmfusion.sh
Last active December 14, 2015 21:49
Configuration script for use with veewee to automatically install the Linux guest tools.
#!/bin/bash
#Mount and install the VMware Fusion guest tools using default settings
kernel=`uname -s`
if [ "${kernel}" == "Linux" ]; then veewee_user="veewee"; elif [ "${kernel}" == "Darwin" ]; then veewee_user="vagrant"; fi
echo "**** Our kernel is ${kernel} and our user is ${veewee_user}."
if [ $kernel == "Linux" ]; then
#Set Linux-specific paths and ISO filename
@bruienne
bruienne / gist:5224157
Last active December 15, 2015 07:29
Find large calendar items in Outlook 2011
Advanced Find (Shift-Cmd-F)
kMDItemFSSize > size_in_bytes
Or, better:
kMDItemFSSize > size_in_bytes && kMDItemContentType = com.microsoft.outlook14.event
Save as a smart folder, rejoice.
@bruienne
bruienne / gist:5506715
Last active December 16, 2015 22:20
Nested JSON to fact example
JSON external fact:
{
<SNIP>
"Conditions": {
"arch": "x86_64",
"hostname": "XXXXXX.local",
"ipv4_address": [
@bruienne
bruienne / gist:5506828
Last active December 16, 2015 22:28
Nested JSON for external facts returns Array
1.9.3-p362 :001 > require 'facter'
=> true
1.9.3-p362 :002 > Facter.loadfacts
=> [#<Facter::Util::DirectoryLoader:0x007f94f20ce4d0 @directory="/etc/facter/facts.d">, #<Facter::Util::DirectoryLoader:0x007f94f20ce4a8 @directory="/etc/puppetlabs/facter/facts.d">]
1.9.3-p362 :003 > Facter.list
=> [:cfkey, :architecture, :augeasversion, :kernel, :testing1, :testing2, :lastcheckdate, :packageverificationmode, :daysbetweennotifications, :logfile, :logginglevel, :lastnotifieddate, :lastcheckresult, :suppressusernotification, :installapplesoftwareupdates, :softwarerepourl, :useclientcertificate, :suppressautoinstall, :suppressstopbuttononinstall, :softwareupdateserverurl, :clientidentifier, :applesoftwareupdatesonly, :managedinstalldir, :availablediskspace, :conditions, :consoleuser, :endtime, :errors, :installresults, :installeditems, :itemstoinstall, :itemstoremove, :machineinfo, :managedinstallversion, :managedinstalls, :manifestname, :probleminstalls, :removalresults, :removeditems, :restartrequired, :runtype
@bruienne
bruienne / gist:5515465
Last active December 16, 2015 23:39
Custom fact module to add contents of Munki's ManagedInstalls.plist file as facts.
managedinstalls = Facter::Util::CFPropertyList.native_types(Facter::Util::CFPropertyList::List.new(:file => "/Library/Preferences/ManagedInstalls.plist").value)
managedinstalls.each do |key, val|
Facter.add("munki_#{key}") { setcode { val } }
end
@bruienne
bruienne / gist:5526042
Created May 6, 2013 15:58
Mark unread archived email as read. Keep your unread count in Outlook 2011 true.
tell application "Microsoft Outlook"
set archiveFolderId to id of folder "Inbox" of folder "On my computer"
set theCounter to unread count of mail folder id archiveFolderId
set newestMsgId to count of messages in mail folder id archiveFolderId
repeat with i from 0 to theCounter
set is read of message (newestMsgId - i) of mail folder id archiveFolderId to true
end repeat
end tell
@bruienne
bruienne / gist:5557275
Created May 10, 2013 20:47
Modification to adobeutils.py to account for CCP-generated pkgs which bury the expected payloads folder at an additional subdir level, hampering the installs key generation.
def getCS5mediaSignature(dirpath):
'''Returns the CS5 mediaSignature for an AAMEE CS5 install.
dirpath is typically the root of a mounted dmg'''
for (path, unused_dirs, unused_files) in os.walk(dirpath):
if path.endswith("/payloads"):
parentdir = path
# now look for setup.xml
setupxml = os.path.join(parentdir, "Setup.xml")
@bruienne
bruienne / gist:5557843
Last active December 17, 2015 05:28
Tree display of CCP-generated pkg contents
Desktop/Photoshop\ CC/Resources/
├── ASU
│   ├── Install.dylib
│   │   └── Contents
│   │   ├── Dylibs
│   │   ├── Frameworks
│   │   ├── Info.plist
│   │   ├── MacOS
│   │   ├── PkgInfo
│   │   ├── Resources
@bruienne
bruienne / gist:5653092
Created May 26, 2013 15:22
DeployStudio web services
/computers/del/entries
/computers/del/entry
/computers/get/all
/computers/get/entry
/computers/groups/del/default
/computers/groups/del/entry
/computers/groups/get/all
/computers/groups/get/default
/computers/groups/get/entry
/computers/groups/new/entry