`caffeinate` is a game changer. Now I can keep my Slack status green without sitting in an empty zoom room. #WFHLife ;)
macOS command-line tools you might not know about
311–320 of 454 posts
Re: macOS command-line tools you might not know about
#312Earlier quoted context omitted.
You may have to install extra voices somehow, looking at the manpage for say, it seems like 'say -v ?' would list the voices installed, but I don't seem to have any (like Whisper), though plain old 'say "hello world"' does do a robotic voice which must be the default.
You can install additional voices in System Settings → Accessibility → Spoken Content → System voice → Manage voices (in Ventura). "Whisper" is listed under "English (US) - Novelty".
Re: macOS command-line tools you might not know about
#313Earlier quoted context omitted.
That's a useless use of cat. You can use `jq . foo.json | pbcopy` or `jq < foo.json | pbcopy`.
In what way do you see those alternatives as superior?
Another sometimes-important difference is that if there are multiple input files, `somecommand file1 file2 file3` can tell what data is coming from which file; with `cat file1 file2 file3 | somecommand` they're all mashed together, and the program has no idea what's coming from where.
In general, though, I think it's mostly a matter of people's expertise level in using the shell. If you're a beginner, it makes sense to learn one very general way to do things (`cat |`), and use it everywhere. But as you gain expertise, you learn other ways of doing it, and will choose the best method for each specific situation. While `cat |` is usually an ok method to read from a file, it's almost never the best method, so expert shell users will almost never use it.
[1] http://redsymbol.net/articles/unofficial-bash-strict-mode/
Re: macOS command-line tools you might not know about
#314Earlier quoted context omitted.
That's a useless use of cat. You can use `jq . foo.json | pbcopy` or `jq < foo.json | pbcopy`.
Speaking for myself, the first form is more natural- even if it’s a useless cat, because I’m always cat-ing files to see their structure. Then progressively tacking on different transforms. And then finally putting it in whatever I want as output. It’s so ingrained, I’m more likely than not to just write it out that way even when I know exactly what I’m doing from the onset.
Many of my programs and scripts start output with the line: # cmd arg1 arg2 arg3 ...
and simply echo back lines that start with '#'. That way, I have an internal record of the program that was run and the data file that was read (as well as previous parts of the analysis chain).
And, 'R' ignores lines starting with '#', so the record is there, but does not affect later analyses.
Re: macOS command-line tools you might not know about
#315`pbcopy` and `pbpaste` are one of my most-loved in the list. Dealing with some minified json, switching to iTerm, doing `pbpaste | json_pp | pbcopy` and having a clean output is _so_ nice.
pbfilter() {
if [ $# -gt 0 ]; then
pbpaste | "$@" | pbcopy
else
pbpaste | pbcopy
fi
}
Then you can use something like `pbfilter json_pp` or `pbfilter base64 -d` or `pbfilter sed 's/this/that/'` or whatever.This version also can also act as a plain-text-only filter. If you just use `pbfilter` with no argument, it'll remove any formatting from the text in the pasteboard, leaving just straight plain text.
It does have a some limitations, though: you can't use it with an alias, or pipeline, or anything complex like that. The filter command must be a single regular command (or function) and its arguments.
Re: macOS command-line tools you might not know about
#316I just freaked out my cat using `say`. I'm going to enjoy this too much.
try it out with different voices, for starters try say "process failure" -v trinoids you can find all the available voices with say -v '?' or from Accessibility>Spoken-Content>System-voice>Manage-voices
Re: macOS command-line tools you might not know about
#317 alias tab='open . -a iterm'
alias phpstorm='open -a "PhpStorm"'
alias smerge='open -a "Sublime Merge"'
etc. I use those more than I do the Open/Recents dialogs in the respective apps.Re: macOS command-line tools you might not know about
#318Earlier quoted context omitted.
I have a clipboard manager application called "Paste" (creative i know). Its an awesome app for a million reasons. But one thing I like is that it allows me to see and hear when my iphone copy worked. So I have it enabled so there is a sound when something goes into the clipboard. Even on my mac, I have come to rely on that audio feedback. But it has the added benefit that when I am using my phone in front of my comp…
I wonder if it's this one: https://apps.apple.com/us/app/paste-clipboard-manager/id9678... I've noticed that more and more apps on both macOS and iOS sniff the clipboard contents and randomly clobber it. I usually notice it in apps like Sourcetree, where I'll click something or do a certain action and suddenly I can't paste anymore. I even get a feel for it, like my mind detects the pattern that empties the clipboard…
Re: macOS command-line tools you might not know about
#319`open` is one I use all the time. I love that simple command. alias tab='open . -a iterm' alias phpstorm='open -a "PhpStorm"' alias smerge='open -a "Sublime Merge"' etc. I use those more than I do the Open/Recents dialogs in the respective apps.
alias finder='open .'