Skip to content

Instantly share code, notes, and snippets.

@matijs
Last active December 10, 2015 18:29
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matijs/4475125 to your computer and use it in GitHub Desktop.
Save matijs/4475125 to your computer and use it in GitHub Desktop.
Useful command line stuff
# use `basename [suffix]` to do clever multiple renaming
for file in *.html.pdf; do \
mv "$file" "`basename $file .html.pdf`.pdf";
done
# remove "from" metadata from files on OS X
xattr -d "com.apple.metadata:kMDItemWhereFroms" file
# remove "quarantine" metadata from files on OS X
xattr -d "com.apple.quarantine" file
# kill coreaudio when redirecting audio to Apple TV stops working
sudo kill `ps -ax | grep 'coreaudiod' | grep 'sbin' |awk '{print $1}'`
# get the base64 encoded string for a file (and optionally copy it to the OS X clipboard)
openssl enc -base64 -in path/to/my/image.png | tr -d '\n' | pbcopy
# rebuild the Launch Service database (removes duplicates from the Open With contextual menu in Finder)
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
# show the last instance of a given command
!command:p
@matijs
Copy link
Author

matijs commented Mar 13, 2013

Thanks @mathiasbynens :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment