Earlier quoted context omitted.
That's a useless use of cat. You can use `jq . foo.json | pbcopy` or `jq < foo.json | pbcopy`.
The “useless cat” meme needs to die. Everyone is aware that most commands accept a file argument, but looking up the arguments and their ordering is annoying and using cat for things like this is just fine.
macOS command-line tools you might not know about
211–220 of 454 posts
Re: macOS command-line tools you might not know about
#212Re: macOS command-line tools you might not know about
#213Earlier quoted context omitted.
Yes, this iterative procedure is often why "useless" cats get put into it. It's a very effective way of processing regular text information. e.g. I need to grab some info from textfile.txt to use as arguments to a function. cat textfile.txt looks like its comma delimited. cat textfile.txt | cut -d, -f 2-5 ah, its the third and fourth column i need cat textfile.txt | cut -d, -f 3-4 | grep '123456' perfect cat textfile…
> cat textfile.txt > looks like its comma delimited. Interesting; why wouldn't you use `head`? Who knows how big textfile.txt is?
Re: macOS command-line tools you might not know about
#214Earlier 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?
Re: macOS command-line tools you might not know about
#215Earlier quoted context omitted.
You can lock the screen while caffeinated though.
Automatic screensaver enable after a period of inactivity is considered a fail safe control.
Re: macOS command-line tools you might not know about
#216Earlier quoted context omitted.
Obviously everything is preference, but I prefer things like expanded regex in gnu grep to the underpowered macOS utils
GNU and BSD grep both default to "basic" regular expressions and both have the `-E` switch to use "extended" expressions.
Re: macOS command-line tools you might not know about
#217Earlier quoted context omitted.
I can’t help but ask, why “,notify” and not just “notify”?
I name all my personal programs prefixed by the comma. I learnt it from someone on lobste.rs. No Unix utilities use the prefix in their name and it is a valid filename. So I can type , and I am sure it's my program and I'm not running something else and it'll autocomplete among my list of programs.
Re: macOS command-line tools you might not know about
#218https://opensource.apple.com/source/cups/cups-450/cups/doc/h...
Re: macOS command-line tools you might not know about
#219Earlier quoted context omitted.
They avoid an unnecessary invocation of the cat executable. Instead, they open a file descriptor and pass that. Tiny difference but there you go.
I teach shell scripting. Cat invocations are cheap and help learners understand and keep clear where input is coming from, and where it is going. There are no awards or benefits to reducing the number of lines, commands invoked, or finding the shortest possible way to perform a task in a script. There are plenty of detriments to reading and understanding though when we try to obfuscate this to save 1ms of execution t…
Re: macOS command-line tools you might not know about
#220 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 -z 64 64 Icon1024.png --out MyIcon.iconset/icon_32x32@2x.png
sips -z 128 128 Icon1024.png --out MyIcon.iconset/icon_128x128.png
sips -z 256 256 Icon1024.png --out MyIcon.iconset/icon_128x128@2x.png
sips -z 256 256 Icon1024.png --out MyIcon.iconset/icon_256x256.png
sips -z 512 512 Icon1024.png --out MyIcon.iconset/icon_256x256@2x.png
sips -z 512 512 Icon1024.png --out MyIcon.iconset/icon_512x512.png
iconutil -c icns MyIcon.iconset
As a bonus, generate .ico with ffmpeg: ffmpeg -i MyIcon.iconset/icon_256x256.png icon.ico
Incidentally, does anyone know enough about the way sips scales PNGs to confirm that it makes sense to create the 16px version straight from 1024px, as opposed to basing it off 32px (and all the way up)? I.e., is it better to downscale in fewer steps (as currently) or in smaller steps?