Mac OS X

Mar 15th, 2018


Preview for PDFs - Incorrect Pages are Bookmarked

Turn off logical page numbers by going to Preferences > PDF and then unticking the Viewing documents: Use logical page numbers box.

Hidden Utilities

afplay - Audio File Play

afplay [option…] audio_file

#loop a file
$ while :; do afplay "file.mp3"; done;
#individually play all file in a directory
find . -name '*.mp3' -exec afplay '{}' \;
brew install transmission-cli watch
#Launch the daemon
#Start the download
transmission-remote -a "magnet:link"
#To have a visual update write: (add the -n flag to specify an interval, the standard is 2 seconds)
watch "transmission-remote -l"
#Stop the daemon
transmission-remote --exit

or create a magnet.links file including magnet: link list of files you want to download, and then run below script to download all.

while IFS= read -r line
transmission-remote -n 'transmission:transmission' -a $line
done <"$file"

Some options:

To target to a directory

transmission-remote -a magnet:?xt=urn:btih:e249fe4dc957be4b4ce3ecaac280fdf1c71bc5bb&dn=ubuntu-mate-16.10-desktop-amd64.iso -w ~/Downloads

To download torrent file

transmission-remote -a ubuntu-16.10-desktop-amd64.iso.torrent -w ~/Downloads
transmission-remote -a -w ~/Downloads

To enable a peer blocklist: Since transmission-cli works different than its GTK counterpart, it often doesn’t save settings. This means peer blocklists need to be specified each time before use. The -b switch enables a blocklist.

transmission-remote -a -w ~/Downloads -b

To download with encryption: It is possible to encrypt the traffic while downloading.

transmission-remote -a -w ~/Downloads -er

To remove a torrent

#remove a torrent with ID 3
transmission-remote -t 3 -r
#remove a torrent with ID 3 and 4
transmission-remote -t 3,4 -r
#remove all torrents
transmission-remote -t all -r

Free NTFS read and write on Mac

Edit fstab file

sudo nano /etc/fstab

Add below line where DRIVE_NAME is the name of the drive. The drive’s name should contain no spaces, as adding a space to the configuration file would tell your Mac to interpret whatever’s after that space as a separate command. If your DRIVE_NAME is made up of two words separated with a space, for example, “NO NAME”, you have to add a “\” before the space for the system to recognize the space. For example, “NO\ NAME”.

LABEL=DRIVE_NAME none ntfs rw,auto,nobrowse

Instead of using above, we can use the following command line.

UUID=Universal Unique Identifier none ntfs rw

Open Disk Utility and check File System UUID by opening Volume Info. Go back to Disk Utility to Unmount then Mount the NTFS disk to see if it is able to read and write to NTFS Disk.