Check These Out
MAC OSX doesn't come with an updatedb command by default, this will emulate the updatedb thats on a typical Linux OS.
Simply add it to your ~/.bash_profile
Tries to switch all audio devices to the A2DP profile for optimal sound quality. Useful for bluetooth speakers and headphones that always power up in HSP/HFP mode. Note however that this command is only a shorthand for the GUI, so it cannot fix stubborn BT controllers that leave your device stuck in HSP mode until a manual re-coupling.
This is best run as root to avoid permission denials that can produce false positives.
Obviously you can specify a directory in the usual way:
$ find -L dirname -type l
I can't remember where I read about this or who deserves the credit for it. The find(1) manual page hints strongly toward it, however.
This command will display all lines between 2 patterns: word-a and word-b
useful for grepping command outputs from file
delete multiple files from git index that have already been deleted from disk. this is pretty terrible, I'm looking for a better way.
(much better!! http://www.commandlinefu.com/commands/view/1246/git-remove-files-which-have-been-deleted)
Finds duplicates based on MD5 sum. Compares only files with the same size. Performance improvements on:
$find -not -empty -type f -printf "%s\n" | sort -rn | uniq -d | xargs -I{} -n1 find -type f -size {}c -print0 | xargs -0 md5sum | sort | uniq -w32 --all-repeated=separate
The new version takes around 3 seconds where the old version took around 17 minutes. The bottle neck in the old command was the second find. It searches for the files with the specified file size. The new version keeps the file path and size from the beginning.
This is a very hackish way to do it that I'm mainly just posting for fun, and I guess technically can more accurately be said to result in undefined behavior. What the command does is tell the shell to treat libpng like it's a shell plugin (which it's most certainly not) and attempt to install a "png_create_read" command from the library. It looks for the struct with the information about the command; since it's always the command name followed by "_struct", it'll look for a symbol called "png_create_read_struct". And it finds it, since this is the name of one of libpng's functions. But bash has no way to tell it's a function instead of a struct, so it goes ahead and parses the function's code as if it was command metadata. Inevitably, bash will attempt to dereference an invalid pointer or whatever, resulting in a segfault.
mount with:
mount -t msdos -o loop ./floppy.img /tmp/mnt