Last active
December 10, 2015 18:29
-
-
Save matijs/4475125 to your computer and use it in GitHub Desktop.
Useful command line stuff
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
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uppercase all Unicode escape sequences in a JavaScript file using GNU
sed
:sed -e 's/\\u\([a-fA-F0-9]\{4\}\)/\\u\U\1/g' x.js
Convert PNGs to JPEGs with medium quality:
Change last-modified date to 13:37 for all files in a directory: