Live data from Hacker News

OS X Command Line Utilities

mitchchn.me

181–190 of 210 posts

Re: OS X Command Line Utilities

#181

For Linux users, `xdg-open` is the equivalent of `open`. The latter exists on Linux, but it will open a socket. There are a number of utilities that handle copy/paste, but `xclip` is probably the most widely used. Screenshots can also be done a number of ways, but `scrot` is my favorite. The two most useful flags to pass with it are `-s` and `-d`. As for `launchctl`, `systemctl` is what you want to use to do the same…

And for cygwin users, cygstart is the equivalent of open, getclip/putclip for copy/paste, and cygrunsrv is the closest equivalent to launchctl.

Re: OS X Command Line Utilities

#182
post #124
post #4

This article was nice, but it indicated that you need to change the system preferences in order to change the voice. It turns out that you can pass the -v flag to use a different voice, or "-v ?" to get a list of names. So you can do say -v Samantha Help, I'm trapped in this castle! or say -v Princess Help, I'm trapped in this castle! But wait, it gets even better: The Mac comes with a number of voices for other lang…

Another fun one: say -v cellos dum dum dum dum dum dum dum he he he ho ho ho fa lah lah lah lah lah lah fa lah full hoo hoo hoo Edit: 'In the Hall of the Mountain King' if anyone is curious. There is also 'Pomp and Circumstance': say -v Good dum dum dum dum dum dum dum dum dum dum dum dum dum dum dum dum dum dum dum dum dum dum and Chopin's 'Funeral March': say -v Bad dum dum dum dum dum dum dum dum dum dum dum dum d…

Those are awesome!

Re: OS X Command Line Utilities

#183
Oftentimes I'll have something on the clipboard, so pbpaste | grep is good. But sometimes the thing I want to search for is long, such that I don't want to type it for the grep.

Fortunately, pbpaste takes a -pboard flag for selecting a different buffer. So cmd-e some text to put it on the find pasteboard, then 'pbpaste | fgrep --color -i "`pbpaste -pboard find`"'

I usually have this aliased to 'pbg'

Re: OS X Command Line Utilities

#184
post #36

pbpaste and pbcopy never really occur in ambiguous situations, so I wrote the following shell script: function clip { [ -t 0 ] && pbpaste || pbcopy } This is easier to type and allows for the following: % echo hello | clip % clip hello

In light of the recent interest in fish shell, the equivalent in fish is:

  function clip
    if not tty >/dev/null
      pbcopy
    else
      pbpaste
    end
  end

Re: OS X Command Line Utilities

#185

One nice application I've found of pbpaste is when I want to count things I find in a browser. For example, to count the (approximate) number of comments in this thread, you can copy all text using Cmd+A, Cmd+C, then run this: pbpaste | grep ago | wc -l In this case there are easier (and more accurate) ways, but in other situations you can use it to find the length of a list on the web where it would otherwise be har…

pbpaste | grep -wc ago

is 0.3% faster and 1.7% more correct :-)

Re: OS X Command Line Utilities

#186
post #97

Earlier quoted context omitted.

I think MacPorts is a much better tool than Homebrew with way more useful packages. It also installs itself into /opt/local by default so it doesn't conflict with other stuff in /usr/local and for actual OS X or X-Windows apps, it installs them in /Applications. Luckily, they can both live on one system if you're careful, as some people insist on providing only Homebrew copies of their software, which is a bit unfort…

I found home-brew much more problematic and more significantly much slower when i last used it (a few years back now).

At this point I've given up on any of these "package managers" for OS X.

I've thought about starting a project (possibly with some support from my company, which focuses on Linux packaging) to provide a) a tool to download and install .pkg files, and b) a toolchain for more easily building .pkg files for the things that aren't available.

Re: OS X Command Line Utilities

#187
post #112

Earlier quoted context omitted.

This is the usual mistake young generations do in regard to UNIX, neither bash nor Git are part of UNIX standard. POSIX IEEE Std 1003.1, 2013 Edition defines sh as the shell. There is no git in POSIX IEEE Std 1003.1, 2013 Edition.

Virtually every person who uses any modern Linux or OS X system expects bash to be installed and in the modern vernacular it can be completely and safely considered, in informal discussion, to be part of relevant Unixes. You knew exactly what he meant, but for some reason (and I won't speculate but it isn't a good look on you) you decided to be pedantic for the sake of being pedantic. You're not being helpful to anyo…

The majority of people who use Bash on OS X will not be using advanced features.

The people that are likely to use advanced features would also hopefully be aware of Bash's fragility/compatibility issues between minor versions, and thus wouldn't rely on it for anything like shell scripts.

So we're left with people who want to use advanced features and are doing so purely on machines they control.. So what stops them from either compiling their own bash, or using one of the third party package managers to install it?

Re: OS X Command Line Utilities

#188
post #95
post #77

Earlier quoted context omitted.

They don't actually know how to speak English. If you listen carefully, what they are doing is sounding out English using the pronunciation rules of their "native" language. It's not an accent at all, just a literal parsing using different rules.

That's precisely what ends up causing an accent, no? Using the sounds and pronunciation of your native language in another one, with different rules. I don't think that Apple has created the World's Best Accent Impersonator here, but it's good for a few laughs.

An accent is when you do it occasionally and accidentally, not pervasively, the wrong way, every single time for every single sound. That's something else.

Re: OS X Command Line Utilities

#189

Earlier quoted context omitted.

Virtually every person who uses any modern Linux or OS X system expects bash to be installed and in the modern vernacular it can be completely and safely considered, in informal discussion, to be part of relevant Unixes. You knew exactly what he meant, but for some reason (and I won't speculate but it isn't a good look on you) you decided to be pedantic for the sake of being pedantic. You're not being helpful to anyo…

The majority of people who use Bash on OS X will not be using advanced features. The people that are likely to use advanced features would also hopefully be aware of Bash's fragility/compatibility issues between minor versions, and thus wouldn't rely on it for anything like shell scripts. So we're left with people who want to use advanced features and are doing so purely on machines they control.. So what stops them…

It shouldn't be the job of a third-party package manager to do this. I want my vendors to stay up to date not just for feature purposes, but for security ones, too. (Remember how long it took Apple to get a Shellshock patch out there?)

But I have less of an interest in that than in discouraging jerkish pedantry.

Re: OS X Command Line Utilities

#190

Earlier quoted context omitted.

Two-part response. 1, the pedantic: technically none of them know how to speak English, or any other language - there's just a rule set for making phonemes based on characters out of waveforms. 2. Ignoring the pedantic response, I still don't think that's true - if that were the case, then Milena wouldn't be able to speak an English sentence! say -v Milena "Hello, I am Milena" If they only speak their own language, t…

It's even more complicated than that: Some voices DO speak multiple languages, e.g. the German voice "Anna" (downloaded from System Preferences) speaks excellent German, English, Spanish, Italian, and French: say -v Anna 'über allen Wipfeln ist Ruh' say -v Anna '[[lang fr_FR]] que restet-il de nos amours' say -v Anna '[[lang it_IT]] chi nasce asino non muore cavallo' say -v Anna '[[lang es_SP]] nosotros tenemos mas i…

No, it doesn't speak Italian, for one 'chi' is pronounced like 'she' and not like 'ki'.
Post reply on HN