Skip to content

Instantly share code, notes, and snippets.

View grahampugh's full-sized avatar

Graham Pugh grahampugh

View GitHub Profile
@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")
@grahampugh
grahampugh / api_test_pkg_jcds2.sh
Last active March 25, 2024 23:25
JCDS2 package upload script
#!/bin/bash
: <<DESCRIPTION
JCDS2 package upload script
by Graham Pugh (@grahamrpugh)
1. Get a bearer token
2. Check for an existing package from the Classic API
3. Check for an existing package from the JCDS endpoint
4. Check that the checksum matches our local pkg
@grahampugh
grahampugh / pkg_upload_aws_cdp.sh
Created March 6, 2024 20:40
A script to upload packages to a Jamf Pro Cloud Distribution Point hosted on AWS S3. Use --help for options.
#!/bin/bash
: <<DESCRIPTION
AWS S3 CDP package upload script
by Graham Pugh (@grahamrpugh)
1. Check for an existing package from the Classic API
2. Upload package to CDP if it's new or changed (this is tested by aws-cli using the sync command)
3. Upload the package metadata
@grahampugh
grahampugh / pkg_upload_jcds2.py
Created August 21, 2023 15:32
Upload a package to Jamf's JCDS2
#!/usr/bin/env python3
"""
A script to upload a package to the Jamf Cloud Distribution Point S3 bucket (JCDS 2.0)
Requirements from pip
boto3
requests
"""
@grahampugh
grahampugh / JamfSmartGroupTemplate.xml
Created May 13, 2022 08:35
SmartGroupTemplate for a "standard" .jamf recipe
<?xml version="1.0" encoding="UTF-8"?>
<computer_group>
<name>%GROUP_NAME%</name>
<is_smart>true</is_smart>
<criteria>
<criterion>
<name>Application Title</name>
<priority>0</priority>
<and_or>and</and_or>
<search_type>is</search_type>
@grahampugh
grahampugh / JamfPolicyTemplate.xml
Created May 13, 2022 08:45
PolicyTemplate for a "standard" .jamf recipe
<?xml version="1.0" encoding="UTF-8"?>
<policy>
<general>
<name>%POLICY_NAME%</name>
<enabled>true</enabled>
<frequency>Ongoing</frequency>
<category>
<name>%POLICY_CATEGORY%</name>
</category>
</general>
@grahampugh
grahampugh / Remove Application.sh
Last active September 28, 2023 13:20
A Jamf Pro script to remove applications in the Applications folder.
#!/bin/bash
#######################################################################
#
# Remove Application Script for Jamf Pro
#
# This script can delete apps that are sandboxed and live in /Applications
#
# The first parameter is used to kill the app. It should be the app name or path
# as required by the pkill command.
@grahampugh
grahampugh / disable-squirrel-updates.sh
Created February 22, 2017 22:03
Disable Squirrel Updates for apps such as Slack, Atom, Whatsapp
#!/bin/bash
# Disable Squirrel updates
# https://macops.ca/disabling-squirrel-updates
#
# Put this script into outset, folder /usr/local/outset/login-every
/bin/launchctl setenv DISABLE_UPDATE_CHECK 1
exit 0
@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 / archive-imap-email.py
Created September 18, 2016 17:46
Archive IMAP E-Mail to local computer
#!/usr/bin/env python
#
# Based on https://gist.github.com/robulouski/7442321
# Extended using code from https://ubuntuforums.org/showthread.php?t=993184
#
# A Python script to dump all emails from each IMAP folder in an account
# to files.
#
# Mail from each IMAP folder is outputted into a sub-folder of the same name.
#