Skip to content

Instantly share code, notes, and snippets.

View grahampugh's full-sized avatar

Graham Pugh grahampugh

View GitHub Profile
#!/bin/bash
####################################################################################################
#
# Change host name
#
####################################################################################################
#
# HISTORY
#
# Version 1.0, 27-Mar-2018, Graham Pugh.
@grahampugh
grahampugh / Prism-postinstall.py
Last active December 10, 2019 20:46
Postinstall script to set configurations for Prism via Jamf Pro. Parameter 4 is the license key.
#!/usr/bin/python
import sys
import xml.etree.cElementTree as ET
'''
This is a postinstall script for Prism. It is used to generate the
prism-config.xml file that stores the serial number and other settings
ready for silent activation.
@grahampugh
grahampugh / Adobe CC Cleaner-postinstall.sh
Created November 18, 2019 15:06
A script to clean up properly the things that Adobe CC Cleaner fails to remove.
#!/bin/bash
## postinstall script to remove CCDA applications
# remove any existing version of the tool
echo "Moving the CC Cleaner app to Utilities in case users need it later"
rm -rf /Applications/Utilities/Adobe\ Creative\ Cloud\ Cleaner\ Tool.app ||:
mv /Applications/Adobe\ Creative\ Cloud\ Cleaner\ Tool.app /Applications/Utilities/Adobe\ Creative\ Cloud\ Cleaner\ Tool.app
# run the cleaner tool to remove EVERYTHING!
echo "Running the CC Cleaner app with 'removeAll=All' option"
@grahampugh
grahampugh / Atom.jss.recipe
Created November 9, 2019 19:43
JSS Recipe Override example
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Identifier</key>
<string>local.jss.Atom</string>
<key>Input</key>
<dict>
<key>CATEGORY</key>
<string>Computer Science</string>
@grahampugh
grahampugh / slack-hourly-jamf-errors.py
Last active October 22, 2019 10:54
Generate hourly Slack error notifications from JAMFSoftwareServer.log files in a multi-context environment
#!/usr/bin/python
#
# Copyright 2019 Graham Pugh
#
# 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
#
@grahampugh
grahampugh / Uninstall OpenJDK 11.py
Last active May 2, 2019 12:37
Uninstalls OpenJDK 11 or any Oracle Java for that matter.
#!/usr/bin/python
'''
Uninstall Java/OpenJDK
Deisgned to be run from Jamf Pro
Parameter 4 needs to be supplied - the version of Java/OpenJDK to remove
'''
@grahampugh
grahampugh / jdk_version.py
Created April 23, 2019 07:43
Print the JDK latest version
#!/usr/bin/python
### JDK Version identifier
def version():
"""Returns the latest installed jdk version"""
import subprocess
import plistlib
jdk_home_output = "/usr/libexec/java_home -X"
java_arch = "x86_64"
@grahampugh
grahampugh / SPSSStatistics Node.pkg.recipe
Created March 29, 2019 14:49
AutoPkg recipe for packaging up SPSSStatistics with a License Code
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Description</key>
<string>Downloads the latest version of SPSSStatistics and creates a package.</string>
<key>Identifier</key>
<string>com.github.grahampugh.recipes.pkg.SPSSStatisticsNode</string>
<key>Input</key>
<dict>
@grahampugh
grahampugh / SPSSStatistics Floating.pkg.recipe
Created March 29, 2019 14:46
AutoPkg recipe for packaging up SPSSStatistics with a Network License
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Description</key>
<string>Downloads the latest version of SPSSStatistics and creates a package.</string>
<key>Identifier</key>
<string>com.github.grahampugh.recipes.pkg.SPSSStatisticsFloating</string>
<key>Input</key>
<dict>
@grahampugh
grahampugh / mysqldump_cron.sh
Created January 15, 2019 18:40
Script to create daily, weekly and monthly mysqldumps and delete old ones
#!/bin/bash
# original source Lyman Lai
# http://002.yaha.me/item/22728a58-c967-46d5-93eb-2649d684a9aa/
# edited by G Pugh 2019-01-15
STORE_FOLDER="/home/MySQL-Backups"
TODAY=$(date +"%Y-%m-%d")