I remember Caffeine used to be a third-party program that would prevent your Mac from sleeping, same behavior as the `caffeinate` here. Were they acquired and incorporated into the OS?
I believe that Caffeine was a fairly simple GUI wrapper for the existing caffeinate command
macOS command-line tools you might not know about
371–380 of 454 posts
Re: macOS command-line tools you might not know about
#372Earlier quoted context omitted.
They avoid an unnecessary invocation of the cat executable. Instead, they open a file descriptor and pass that. Tiny difference but there you go.
To add, searching for “useless use of cat” will yield several results for those interested in learning more. Other examples include “useless use of echo” and “useless use of ls *”.
Even the Wikipedia page on cat has a section about that, titled eponymously.
Re: macOS command-line tools you might not know about
#373I'll go for the somewhat obsolete `drutil eject` as Mac OS can be sometimes rather reluctant to eject cycle optical drives if it doesn't actually think a disc in in them. Although nowadays you'll probably be using a 3rd party tray load drive with an eject button instead of a no-button slot loading Apple one.
Re: macOS command-line tools you might not know about
#374Re: macOS command-line tools you might not know about
#375Needs to mention afplay for playing audio! You can easily use this to make a command-line MP3 player. Others have mentioned the “say” utility for speech synthesis. There is a lot you can do with it, it supports the TUNE format, which allows you to "shape the overall melody and timing of an utterance... for example ... to make an utterance sound as if it is spoken with emotion". See: Apple's Speech Synthesis Programmi…
Re: macOS command-line tools you might not know about
#376Earlier quoted context omitted.
Since I'm bouncing between OSX and Linux a lot, I have a shell script with the same name on each that boils down to: if [ `uname` == "Darwin" ]; then pbcopy else xsel --clipboard fi
why not just alias?
Re: macOS command-line tools you might not know about
#377I use this to convert an mp3 to a variable rate m4b for Books:
afconvert -v -s 3 -f m4bf meditation1.mp3Re: macOS command-line tools you might not know about
#378Earlier quoted context omitted.
I have a script always running that polls for youtube URLs using pbpaste and runs yt-dl then just highlight any youtube link and COPY later when I have time, I can use quicklook to browse directory of youtube videos.
FYI: yt-dlp is more up to date and faster, AFIK: https://github.com/yt-dlp/yt-dlp I download and save it as 'ytdl' for convenience, but I use it all the time on twitter too.
Re: macOS command-line tools you might not know about
#379Earlier quoted context omitted.
For me it’s one of the top benefits of the Apple ecosystem. The only drawback is that yes it only works most of the time. And when it doesn’t I get infuriated. Glitches happen without any change to settings or network on my side - it works now, and 5 min later doesn’t.
Some of the “not working” cases may be due to the application you’re copying from setting the items as `localOnly`, ex: from a password manager. I don’t have an explanation for other failures. https://developer.apple.com/documentation/uikit/uipasteboard...
Re: macOS command-line tools you might not know about
#380Earlier quoted context omitted.
They avoid an unnecessary invocation of the cat executable. Instead, they open a file descriptor and pass that. Tiny difference but there you go.
Not just that, but also all the bytes have to go through an extra pipe. Presumably they're copied an extra time because of this. When you run "cmd < file", the command reads from stdin, which pulls directly from the file. When you do "cat file | cmd", "cat" opens the file, reads from there, and writes to a pipe. Then "cmd" reads from its stdin, which is a pipe.
copy_file_range allows a user land program to copy data between two files without doing any user space work. Instead of reading data into a buffer and writing it back out to the destination, the kernel will somehow manage to move the data for you.
I think this will prevent any extra copies from occurring in situations where it can be used.
https://man.archlinux.org/man/copy_file_range.2
https://git.savannah.gnu.org/cgit/coreutils.git/tree/src/cat...