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
#!/bin/bash | |
# Free memory | |
memory_free=$(vm_stat | awk '/Pages free/{ print $NF }' | sed 's/.$//') | |
memory_speculative=$(vm_stat | awk '/speculative/{ print $NF }' | sed 's/.$//') | |
memory_inactive=$(vm_stat | awk '/Pages inactive/{ print $NF }' | sed 's/.$//') | |
# Used memory | |
memory_app=$(( $(sysctl -n vm.page_pageable_internal_count) - $(vm_stat | awk '/Pages purgeable/{ print $NF }' | sed 's/.$//') )) | |
memory_wired=$(vm_stat | awk '/Pages wired/{ print $NF }' | sed '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 f; do | |
file=${f##*/} | |
if [ -f $dest/$file ]; then | |
n=1 | |
while [ -f $dest/${file%%.*}-$n.${file##*.} ] | |
do (( n++ )) | |
done | |
file=${file%%.*}-$n.${file##*.} | |
fi | |
mv $f $dest/$file |
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)" |
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
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
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
# 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
<?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
while IFS= read -r path; do | |
file "$path"/Contents/MacOS/* | awk -F: '!/for/&&/i386/&&!/x86_64/{gsub("^.*/","");print $1}' | |
done < <(find /Applications -name "*.app") |
NewerOlder