This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# stop print services | |
launchctl stop org.cups.cupsd | |
# back up existing configs | |
mv /Library/Printers/InstalledPrinters.plist /Library/Printers/InstalledPrinters.plist.bak | |
mv /etc/cups/cupsd.conf /etc/cups/cupsd.conf.bak | |
mv /etc/cups/printers.conf /etc/cups/printers.conf.bak |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## REMOVE FIRST CHARACTER FROM STRING | |
sed '/^.//' | |
== Example == | |
$ echo "foo" | sed 's/^.//' | |
oo | |
____________________________________________________________________ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
user=$(/usr/bin/python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser;import sys;username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0];username = [username,""][username in [u"loginwindow", None, u""]];sys.stdout.write(username + "\n");') | |
pass=$(osascript -e 'display dialog "Enter password:" default answer "" giving up after 60 with text buttons {"Authenticate"} default button 1 with hidden answer' -e 'return text returned of result') | |
attempts=1 | |
until dscl . authonly "$user" "$pass" &>/dev/null ; do | |
# lines 9 and 10 are only necessary if you wish to display no. of attempts remaining before failure | |
attemptsRemaining=$(( 4 - attempts )) | |
[[ $attemptsRemaining -eq 1 ]] && s= || s=s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while IFS= read -r path; do | |
file "$path"/Contents/MacOS/* | awk -F: '!/for/&&/i386/&&!/x86_64/{gsub("^.*/","");print $1}' | |
done < <(find /Applications -name "*.app") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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>Label</key> | |
<string>com.company.app.daemon</string> | |
<key>StartInterval</key> | |
<integer>10</integer> | |
<key>RunAtLoad</key> | |
<true/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. Delete device record from JSS Computer inventory | |
# 2. Remove jamf management framework from computer | |
sudo jamf removeFramework | |
# 3. Force Setup Assistant to re-run | |
sudo rm -f /var/db/.AppleSetupDone | |
# 4. Reboot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find -x / /System/Library/* -flags restricted -prune -print |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
str=$(echo -e "$(cat <<EOF | |
this | |
\tis | |
\t\tmy | |
\t\t\theredoc | |
EOF | |
)") | |
echo "$str" > file.ext |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# print only timestamp + log message | |
log show --style compact --info --debug --predicate 'subsystem == "com.apple.example"' \ | |
| cut -d' ' -f1-2,4- \ | |
| sed 's/\[.*:.*\]/:/g' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo dscl . passwd /users/root "$(env LC_CTYPE=C tr -dc 'A-Za-z0-9_\ \!\@\#\$\%\^\&\*\(\)-+=' < /dev/urandom | head -c 32)" |