Live data from Hacker News

OS X Command Line Utilities

mitchchn.me

71–80 of 210 posts

Re: OS X Command Line Utilities

#71
post #70

Remove unwanted formatting from text in the clipboard: alias pbclean='pbpaste | pbcopy'

I wrote "write the clipboard to a temp file; open it in vim; when vim exits, if the temp file has been written, load it into the clipboard". Pretty convenient.

Also, (though not, I think, relevant to OS X), binding a key to move content between PRIMARY and CLIPBOARD on X Windows has been very nice.

Re: OS X Command Line Utilities

#72

I like do harmless pranks on coworkers who don't lock their computers yes "lock your computer, numbskull" | xargs say Just repeats the phrase in a monotone computer voice over their headphones. I only do this to engineers, tried it on a PM once, never again.

I think it's more fun with at...

Re: OS X Command Line Utilities

#73
post #57
post #40

Earlier quoted context omitted.

Without something like Homebrew you don't get any current Unix tools (OSX shell is way out of date) or anyway to systematically update them. This is a big benefit that far outweighs any perceived benefit dropping bundles into /Applications. And you get some attempt at installation of dependencies.

What are current UNIX tools? OS X supports what is expected from a POSIX compliant OS. I guess you mean BSD and GNU extensions to POSIX.

OS X ships outdated versions of Bash and Git for example. The 10.10.5 version ships Bash 3.2 and Git 2.3, while Homebrew gives you Bash 4.3+ and git 2.5+.

Re: OS X Command Line Utilities

#74
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…

Imo the non-English voices speaking English aren't that useful as accented voices, because, at least for the Latin-alphabet ones, they're dominated by spelling-to-phonology mapping errors, like misreading diphthongs. It's an okay representation of someone who really speaks no English trying to sound out written English as if it were German, but it's not very similar to what a German accent in English sounds like, since a typical German accent isn't dominated by misreadings.

If it were open source you could probably get better results by hacking it up to parse in the "right" language and then only realizing the phonology in the "wrong" language, instead of both parsing and speaking in the "wrong" language.

Re: OS X Command Line Utilities

#75
Great list, not a big fan of homebrew personally, or its creator who seems to be full of himself. I'd recommend pkg_src from joyent[0]. homebrew seems to have a lot of the hip webdev packages, but pkg_src and joyent's repository is the real deal when it comes to hardcore UNIX package management. Some friends have a nice bootstrap for pkg_src on OS X called saveosx[1], too.

[0]: https://pkgsrc.joyent.com/install-on-osx/

[1]: http://www.saveosx.org/

Re: OS X Command Line Utilities

#76
post #66
post #55

This is a great intro. Here's my favorite OS X Terminal trick: ⌘. (command period) is a hotkey not defined in the menu for sending BREAK. This is automatically equivalent to ctrl+c in shells, ctrl+g in emacs and ESC in Vim. Similarly, ⌘K is short for clearing the screen. These are much more ergonomic than the standards on Mac laptops and wireless keyboards.

How is cmd + K different from cmd + R and/or $ clear?

Using ⌘+K will not only clear the screen, but will also delete the scrollable history buffer in Terminal or iTerm2.

I find this useful before printing text that I want to search using ⌘+F.

Re: OS X Command Line Utilities

#77
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…

This is great, and the voices apparently only know how to speak English, and their own language! That is, typing say -v Milena "Здравствуйте, меня зовут Milena. Actually says, "Zdravstvuyte...", while typing say -v Bruce "Здравствуйте, меня зовут Milena. Results in "Cyrillic capital letter 'Z'. Cyrillic small leter 'd'.", etc.

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.

Re: OS X Command Line Utilities

#78
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…

This is great, and the voices apparently only know how to speak English, and their own language! That is, typing say -v Milena "Здравствуйте, меня зовут Milena. Actually says, "Zdravstvuyte...", while typing say -v Bruce "Здравствуйте, меня зовут Milena. Results in "Cyrillic capital letter 'Z'. Cyrillic small leter 'd'.", etc.

"Bruce" triggered the English response? That's a weird ML algorithm.

Re: OS X Command Line Utilities

#79
post #25

I like do harmless pranks on coworkers who don't lock their computers yes "lock your computer, numbskull" | xargs say Just repeats the phrase in a monotone computer voice over their headphones. I only do this to engineers, tried it on a PM once, never again.

Have you ever asked yourself if maybe you're just being annoying? I don't lock my computer. It'll time out and lock after an hour but I prefer to leave it unlocked.

Seems like a harmless prank to me.

Re: OS X Command Line Utilities

#80
post #28
post #25

Earlier quoted context omitted.

Have you ever asked yourself if maybe you're just being annoying? I don't lock my computer. It'll time out and lock after an hour but I prefer to leave it unlocked.

That's pretty terrible opsec. It presents a risk to separation of roles / compartmentalization if a coworker can walk over to your workstation and have access to it, to say nothing of malicious access by somebody who shouldn't be in the office in the first place.

Security requires a threat model to rise above theatre. If there are operations threats to your organization, then you need opsec to mitigate those threats. Is China or someone else trying to steal your trade secrets?

If so, I would hope the responsibility for setting opsec policy isn't resting in one sysadmin.

Post reply on HN