Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# NOTE: this is an OSX launchd wrapper shell script for Tomcat (to be placed in $CATALINA_HOME/bin)
CATALINA_HOME=/Users/username/tomcat
function shutdown() {
date
echo "Shutting down Tomcat"
$CATALINA_HOME/bin/catalina.sh stop
#!/bin/bash
# Check for expiring password, then prompt to change with cocoaDialog
# Kris Payne
# Variables
user=`ls -l /dev/console | awk '{ print $3 }'`
pwdThreshold=7
pwdPolicy=90
CD="/Applications/Utilities/CocoaDialog.app/Contents/MacOS/CocoaDialog"
@krispayne
krispayne / macs-on-active-directory.md
Created October 8, 2015 00:55 — forked from bzerangue/macs-on-active-directory.md
Binding and Unbinding to Active Directory from Mac OS via Command Line

Binding and Unbinding to Active Directory from Mac OS via Command Line

  • Open the Terminal Application
  • Type in sudo -i and type in your Mac Administrator account password. sudo gives you root level or administrator level privileges.

To View current Active Directory Settings

dsconfigad -show

To Unbind a Computer from an Active Directory Domain

sudo scutil --set ComputerName "newname"
sudo scutil --set LocalHostName "newname"
sudo scutil --set HostName "newname"
sudo /usr/sbin/jamf createAccount -username netadmin -realname "Network Administrator" -password "p@55w0rd" -home "/var/netadmin" -hiddenUser -admin -secureSSH
zip -r -X Premiere_Pro_Install.pkg.zip Premiere_Pro_Install.pkg
@krispayne
krispayne / jss-delete-computer.sh
Last active February 10, 2016 16:51
Delete Computers from a JSS based off a CSV of Serial numbers.
#!/bin/bash
# Deletes a machine from the JSS based off serial number from CSV
CSV="serials_to_remove.csv"
URL="https://your.jss.com:8443"
OLDIFS=$IFS
IFS=,
[ ! -f $CSV ] && { echo "$CSV file not found"; exit 99; }
while read serial
#!/bin/bash
# Allow anyone to install a printer
# https://jamfnation.jamfsoftware.com/discussion.html?id=14640
echo Adding users to lpadmin
dseditgroup -o edit -n /Local/Default -a everyone -t group lpadmin
defaults write /System/Library/LaunchAgents/com.apple.printuitool.agent.plist Disabled -bool YES
defaults write /System/Library/LaunchAgents/com.apple.printuitool.agent.plist EnableTransactions -bool NO
security authorizationdb write system.preferences allow
security authorizationdb write system.print.operator allow
#!/bin/bash
# gmail message recall
# requires Got Your Back https://github.com/jay0lee/got-your-back and a service account.
CSV="user-list.csv"
MSGID="" # Enter the full message ID here from the "Show Original" in Gmail. Leave out the '<>'
GYB="" # location of Got Your Back pythyon script /Users/username/gyb/gyb.py
DOMAIN="" # google apps domain e.g. google.com
OLDIFS=$IFS
#!/bin/bash
# Provide user info about the computer
# Kris Payne
# run this shiz in a policy in Self Service. It will let the user copy their IP or Computer name for you.
# slower than >System Preferences>Network ? Yes. Easier to explain? Yes.
# Definitions
thisComputerName="scutil --get ComputerName | pbcopy"
thisIPAddress=$(ifconfig | grep "inet " | grep -v 127.0.0.1 | awk {'print $2'} | pbcopy)