Live data from Hacker News

macOS command-line tools you might not know about

saurabhs.org

431–440 of 454 posts

Re: macOS command-line tools you might not know about

#431

Nice list. Also, hidutil ( https://developer.apple.com/library/archive/technotes/tn2450... ). Example: hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000049,"HIDKeyboardModifierMappingDst":0x700000065}]}' For my PC keyboard, remaps "Ins" (normally useless under macOS) to something ("PC Execute") I can trap and remap with Keyboard Maestro.

There's a nice generator for these mappings https://hidutil-generator.netlify.app/

Oh wow, this is amazing. I had been unable to _swap_ esc and caps lock on the mac until now.

Re: macOS command-line tools you might not know about

#432
post #106

Use ‘ditto’ for copying directories. It is fast! https://osxdaily.com/2014/06/11/use-ditto-copy-files-directo...

Ditto can also be useful for backup and restore since, AFAICT, it preserves file meta data. (Unlike rsync for example.)

`ditto` will also preserve resource forks, which is occasionally necessary for not breaking apps or installer pkgs. I've had to use it when doing a semi-automated deployment of some zipped-up software to a hundred or so Macs via bash over ARD. `ditto -xkv`

Re: macOS command-line tools you might not know about

#434
post #430

Earlier quoted context omitted.

I use Pushover for a few alerts so years ago I wrote a little bash script called `push` that you pass a title and optionally a body. Was very nice to to `./longRunningCommand && push "Task Done" "Here is a body"`. I'd sometimes combine this with my `beep` script that just makes a noise for when I know I'll still be at my computer but want to know when something finishes.

What's the beep script like? Do you use the terminal bell or does it synthesize a tone?

Here is my beep script, it's almost embarrassingly basic. You can pick a different sound, I wanted one that wasn't too offensive/harsh and I've used this for 3-4+ years.

#!/bin/bash

afplay -v 3 /System/Library/Sounds/Glass.aiff

Re: macOS command-line tools you might not know about

#435

Earlier quoted context omitted.

I’d say hand-crafting pixel-perfect icons with different versions for extreme sizes is worthwhile (and I don’t believe in simple rasterization from vector for the same reason), but not every developer would have resources to spare for that.

I was lucky enough to oversee a project replacing seven hundred icons back in 2017, and we hand-adjusted the low resolution versions of 16x16 and 24x24. > “…notice that the icons are not simply the same image scaled up or down. TTrackBar is a good example of this: at each size, the small indicator marks are different. An icon designed for 16×16 or 32×32 won’t resize and scale to look good at 24×24, because the pixel…

Thanks for the insight. My script targets a solo dev such as myself, but crafting icons is always superior.

As a designer, the way I recommend to do it is not by tweaking icons but by having a specific process separating design from deliverables. Define branding language, come up with your symbols and marks and mascots and their use guidelines, and then prepare deliverables based on that. Icons intended to be used at extremely different sizes (16px vs. 512px) and in different contexts are different deliverables.

Re: macOS command-line tools you might not know about

#436
post #428

Earlier quoted context omitted.

I've used AU Lab to pipe my microphone input through my headphones, which is apparently how professionals like to record audio (a "monitor" so you can hear how you sound), but I couldn't get used to it

How was the latency when you last tried it? Most outboard audio interfaces (even inexpensive ones like the Focusrite Scarletts with ≤ 2 inputs) have a "direct monitor" feature that is as close to zero-latency as you can reasonably get.

I don’t remember, or have context for how it feels when it’s instant, so I’m a bad tester.

Maybe that’s why I didn’t like it, a tiny bit of latency seems like a killer in that scenario

Re: macOS command-line tools you might not know about

#437
post #406
post #400

Earlier quoted context omitted.

It tests your bandwidth while fully saturating your upload AND your download. If maxing out your upload has a huge impact on your download (like, a 70% drop), then that’s probably a sign you could tweak your network for better flow control. That’s sort of the idea of `networkQuality`. It’s a new idea for how to measure that’s different from the standard speed test. Through if you run it with the `-s` flag it’ll test…

In my case, it appears that maximizing my download has a huge impact on my upload as well, which makes sense from a TCP/IP point of view. In this case, do you mean the ISP's flow control?

I'm sure others know waaay more about this, but I think it's a thing you can improve locally. Though usually I think of it as the other way around, where maxing out upload severely impacts download. My understanding is that this causes bufferbloat[0], making packets queue up for a long time on your gateway, ultimately limiting you to way less bandwidth then you should be able to get.

My one experience with this is on Ubiquiti hardware where there's a feature called "Smart Queues" you can enable. Really it's FQ_CODEL[1] under the hood. If you tell it your real maximum up/down bandwidth, minus ~5%, it'll enforce those limits in a way that prevents buffer bloat and lets you use nearly your full download bandwidth even when your upload bandwidth is maxed out. On Ubiquiti gear this has a CPU impact since it has move some traffic handling from dedicated hardware to the CPU. But it was a huge night and day difference for me. After enabling this, having a couple people on Zoom calls (highish upload) no longer tanked everyone else's download speed.

Also I think this stuff matters more when you have a large multi-user network. For normal home life, definitely not worth it. (In my case it was wifi for ~20 people).

[0] https://en.wikipedia.org/wiki/Bufferbloat [1] https://en.wikipedia.org/wiki/CoDel

Re: macOS command-line tools you might not know about

#438

Not a command-line tool but the network link conditioner is also really great. Never seen such a tool on another OS You can simulate a really bad network. Latency, bandwidth, packet loss etc. Great for testing but also if people insist on cameras being on. Just screw up the connection so bad that everyone gets annoyed with your blocky image and robot voice and suggest you turn off video and then you make it 'magicall…

Note that NLC is a GUI interface to control dummynet and PF (packet filter). It sets up rules to inject packet relay and drop a certain percentage of packets based on the profile.

You can use dnctl and pfctl on macOS to do similar things and more.

Re: macOS command-line tools you might not know about

#439
post #417

Earlier quoted context omitted.

I have! Unfortunately not supported in MacOS Terminal.app, which I'm otherwise very satisfied with (have tried iTerm2, use Alacritty on Linux, just like Terminal.app).

Simply wrap your shell with osc52pty to get OSC52 support in Terminal.app https://github.com/roy2220/osc52pty

I don't think wrapping my entire shell session in a moderately complex third party tool (that maybe just uses pbcopy under the hood[1]) counts as "simply" when compared to my existing solution which just pipes over ssh and a couple bash scripts.

But thank you for the share, it is interesting!

[1]: https://github.com/roy2220/osc52pty/blob/master/oscexecutor....

Re: macOS command-line tools you might not know about

#440
post #425

Earlier quoted context omitted.

I've used this one for over a decade now. When I was a teacher, I even assigned it to a key-combo. Consider pairing with a few other things you might want in a presentation setting

What do you use for assigning it to a key combination? Can it be done without a third party tool?

Automator should be able to do that.
Post reply on HN