Live data from Hacker News

macOS command-line tools you might not know about

saurabhs.org

401–410 of 454 posts

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

#401
post #295
post #3

Neat, I was not aware of `networkQuality`. A good replacement for opening up Speedtest or whatnot when you just want to figure out if the network is slow or something else is up.

I can't find any (official) documentation on how it measures the speed. Against which target? Edit: Found https://www.macinstruct.com/tutorials/how-to-check-your-macs... which says: "The networkquality tool uses Apple’s CDN ( https://mensura.cdn-apple.com/api/v1/gm/config ) as a target" The contents of this file (for me): { "version": 1, "test_endpoint": "sesto4-edge-bx-021.aaplimg.com", "urls": { "small_https_downlo…

It’s a new proposed standard that’s gaining support. People are building alternative party implementations for it: https://github.com/network-quality/goresponsiveness

Try running it with `-s` to see if you get speed tests that resemble what you expect. The idea is that maxing out both links at once is a better measure of network quality than sequence speed tests. Also it’s new RTT metric is key.

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

#402

Earlier quoted context omitted.

If you really want nice looking smaller icons (16x16, 32x32) you'll have to hand edit them after scaling down to get something that looks crisp. That said I just checked some macOS system icons (get info on app, select icon, copy, create new document in Preview.app) and they don't seem to be hand adjusted any more.

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 grid is different. Even if we support antialiasing, a 1-pixel-wide line looks much cleaner when it takes up one pixel in the image, rather than being approximated through antialiasing over several pixels, which makes it look blurry. Similarly, shape edges should be snapped to the pixel grid for each size. We’ve gone through and tweaked the icons for each different pixel grid.”

This meant that not only did we tweak the icons at the small sizes (in the example above for a track bar control, we don’t use the large size 128x one scaled down to 16x even though they are both built on a 16x grid) but that we used a different base grid for the 24x and 48x versions compared to all other sizes.

It took time. And not everyone has those resources. But if you can, it is the right thing to do.

https://blogs.embarcadero.com/new-in-10-2-2-component-icons/

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

#403

Earlier quoted context omitted.

I have linux/macos-agnostic bash functions in my dotfiles that unify this to “clip” and “paste” (since “copy” is too close semantically to “cp”)

And I have one that unifies _both_ to `clip` so you can put the same command in both sides of the pipe, e. g. to turn a line-delimited blob on your clipboard to a space-separated one: clip | tr '\n' ' ' | clip https://github.com/svieira/dotfiles/blob/a3654d6a194e3689978... # Use clipboard in shell pipelines # clip | xargs echo # uses pbpaste # ps -A | grep search | clip # uses pbcopy clip() { [ -t 0 ] && pbpaste || p…

Holy crap. Of course! You win! Amazing!

Simple is genius

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

#404

Needs 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…

Unfortunately, the TUNE format turned out to be a bit of an evolutionary dead end; the last generation of Speech Synthesis that supports it is the Alex voice which shipped in 2007, and it's highly unlikely in my opinion that we'll ever see it again — pinpoint control of synthesis and naturalness are inherently in tension, and the latter is a lot more valuable.

It is unfortunate. But Alex does sound pretty good! Not up to 2023 standards maybe but still pretty good.

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

#406
post #400
post #57

Earlier quoted context omitted.

It seems to grossly underestimate my upload bandwidth!

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?

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

#407
post #283

I like to hide all icons or folders on my Desktop when I need to be more productive or when I'm presenting. This can be done with: # hide desktop icons and folders defaults write com.apple.finder CreateDesktop 0 killall Finder # restarting Finder is required # unhide desktop icons and folders defaults write com.apple.finder CreateDesktop 1 killall Finder # restarting Finder is required I made myself a convenient bash…

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

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

#408

Years ago, I wrote a script to find something in a big blob of data and to alert me when it was done, I added a “say ” type phrase upon completion. I forgot about it and went to bed and was jolted awake hours later by what was clearly an “intruder” speaking to his accomplice, in my home office. Quite the relief when I realized what happened.

I like to use the "research complete" sample from StarCraft for this.

It's comments like this that remind me that HN is my tribe.

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

#409
post #205

Shoutout to the `diskutil` command line utility on macOS. I had problems with some slices on a disk today, and was not able to fix it with the graphical Disk Utility that comes with macOS. These slices were remnants from experimenting with running Asahi Linux on the machine in the past. I knew there had to be a way to fix it with diskutility cli program. I found a thread, and the solution for what to do in such situa…

`diskutil` is great but it's a travesty what they did to Disk Utility.app. It never really got any love after the APFS transition and there are things it straight up fails to do the `diskutil` command doesn't. Before they re-designed the interface, it was such a rock-solid tool that even if it failed during some task, would typically tell you why. Now it's a baby LEGO Duplo interface meant for nothing more than refor…

I still open it sometimes thinking it's going to be a great experience, forgetting about this.

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

#410

You can use sips together with iconutil to generate a complete .icns file for your app from a single 1024 by 1024 PNG without any third party software: mkdir MyIcon.iconset cp Icon1024.png MyIcon.iconset/icon_512x512@2x.png sips -z 16 16 Icon1024.png --out MyIcon.iconset/icon_16x16.png sips -z 32 32 Icon1024.png --out MyIcon.iconset/icon_16x16@2x.png sips -z 32 32 Icon1024.png --out MyIcon.iconset/icon_32x32.png sips…

Perfect timing. I need to generate an.icns today and I'm going to try this. Thanks :)
Post reply on HN