Skip to content

Instantly share code, notes, and snippets.

Avatar

Matthew Warren haircut

View GitHub Profile
@haircut
haircut / remove-false-google-docs-g-suite-tokens.sh
Last active May 4, 2017
Thanks to @chadnielsen on macadmins#g-suite - Comment out line 39 to audit rather than remove
View remove-false-google-docs-g-suite-tokens.sh
#!/bin/bash
# Scan and Remove False Google Docs Tokens
# Assumes GAM is installed. Change the path if you need to.
###################################[ VARIABLE DEFINITIONS ]##################################
#set -x
runINT="3600" #seconds
runDATE=$(date +%d-%m-%Y-%H-%M)
@haircut
haircut / run_jamf_policy.py
Last active Jul 31, 2018
Utility function to run a Jamf Pro policy
View run_jamf_policy.py
# encoding: utf-8
import subprocess
def run_jamf_policy(p):
"""Runs a jamf policy by id or event name"""
cmd = ['/usr/local/bin/jamf', 'policy']
if isinstance(p, basestring):
View close-app-before-update.sh
#!/bin/bash
#
# Script: Safely Close Application
#
# Description:
# Safely closes and application after alerting user and prompting to save
# any unsaved documents (if applicable).
#
# Parameters:
# - app_name: Name of the application
@haircut
haircut / clear-saved-printer-passwords.sh
Created Feb 12, 2017
Removes keychain entries in the logged-in-user's login keychain related to campus print servers. Useful after password changes.
View clear-saved-printer-passwords.sh
#!/bin/bash
###
#
# Name: clear-saved-printer-passwords.sh
# Description: Removes keychain entries in the logged-in-user's login keychain
# related to campus print servers. Useful after password changes.
# Author: Matthew Warren <bmwarren@unca.edu>
# Created: 2015-08-15
# Last Modified: 2017-02-11
@haircut
haircut / Quit-All-Apps-With-Whitelist.sh
Created Feb 8, 2017
Closes all running apps, excluding those found in a customizable whitelist
View Quit-All-Apps-With-Whitelist.sh
#!/bin/sh
# Quit apps command
read -r -d '' OSASCRIPT_COMMAND <<EOD
set white_list to {"Finder"}
tell application "Finder"
set process_list to the name of every process whose visible is true
end tell
repeat with i from 1 to (number of items in process_list)
set this_process to item i of the process_list
View Keychain-Repair.sh
#!/bin/bash
#####################################
#
# Keychain Repair
#
# Removes a User's login keychain, creates a new login keychain, sets it
# as the default keychain, deletes any Local Items keychain folders,
# then reboots the system interactively
#
# University of North Carolina Asheville ITS
@haircut
haircut / com.apple.Safari.plist
Last active Feb 7, 2018
Disables adding common "Internet Accounts", disables auto-open of "Safe" downloads, disables all form autofill
View com.apple.Safari.plist
<?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>AutoOpenSafeDownloads</key>
<false/>
<key>DomainsToNeverSetUp</key>
<array>
<string>aol.com</string>
<string>facebook.com</string>
View TestPDefs.pdef
<PrinterDefinitions>
<Printer>
<Name>Example Printer</Name>
<Server>print.org.edu</Server>
<ShareName>ExamplePrinter</ShareName>
<SMBURI>smb://print.org.edu/ExamplePrinter</SMBURI>
<LPDURI>lpd://print.org.edu/ExamplePrinter</LPDURI>
<Location>Lobby</Location>
<Option>option_one=value</Option>
<Option>second_opt=something</Option>
View SetRemoteManagement.sh
#!/bin/bash
LOCALADMIN="username"
kickstart=/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart
echo "Configuring Remote Management"
if id -u $LOCALADMIN >/dev/null 2>&1; then
echo "Defined local admin account exists"
# Deactivate ARD agent, deny all access
echo "Deactivating ARD agent"
View AdwareMedic-Supplement.adf
<AdwareDefinition>
<Version>1.0</Version>
<DefinitionAuthor>Matthew Warren</DefinitionAuthor>
<DefinitionSource>http://www.adwaremedic.com/signatures.xml</DefinitionSource>
<!-- Supplemental ADF based on AdwareMedic Signatures. Should be used as
a complement to the default HT-203987 definitions
-->
<Adware>
<AdwareName>FkCodec</AdwareName>
<!-- Does not remove related browser extensions -->