Function to quickly create an application icon from 1024px master file.
function mkicns() {
if [[ -z "$@" ]]; then
echo "Input file missing"
else
filename=${1%.*}
mkdir $filename.iconset
sips -z 16 16 $1 --out $filename.iconset/icon_16x16.png
sips -z 32 32 $1 --out $filename.iconset/[email protected]
sips -z 32 32 $1 --out $filename.iconset/icon_32x32.png
sips -z 64 64 $1 --out $filename.iconset/[email protected]
sips -z 128 128 $1 --out $filename.iconset/icon_128x128.png
sips -z 256 256 $1 --out $filename.iconset/[email protected]
sips -z 256 256 $1 --out $filename.iconset/icon_256x256.png
sips -z 512 512 $1 --out $filename.iconset/[email protected]
sips -z 512 512 $1 --out $filename.iconset/icon_512x512.png
cp $1 $filename.iconset/[email protected]
iconutil -c icns $filename.iconset
rm -r $filename.iconset
fi
}
hdiutil create -volname "Volume Name" -srcfolder /path/to/folder -ov diskimage.dmg
If you'd like to encrypt the disk image:
hdiutil create -encryption -stdinpass -volname "Volume Name" -srcfolder /path/to/folder -ov encrypted.dmg
By default, you'll be prompted for a password. You can automate that by piping in a password:
echo -n YourPassword | hdiutil create -encryption -stdinpass -volname "Volume Name" -srcfolder /path/to/folder -ov encrypted.dmg
Supported formats are plain text, rich text (rtf) and Microsoft Word (doc/docx).
textutil -convert html file.ext
If multiple windows are open, it chooses the top-most one.
cd "$(osascript -e 'tell app "Finder" to POSIX path of (insertion location as alias)')"
open .
Prevent sleep for 1 hour:
caffeinate -u -t 3600
afconvert input.mp3 ringtone.m4r -f m4af
say 'All your base are belong to us!'
defaults write com.apple.QuickTimePlayerX MGPlayMovieOnOpen 1
This outputs all applications currently using port 80.
sudo lsof -i :80
dig +short myip.opendns.com @resolver1.opendns.com
Exchange SSID with the SSID of the access point you wish to query the password from.
security find-generic-password -D "AirPort network password" -a "SSID" -gw