HNHacker News
TopNewBestAskShowJobs

mathfailure

319 karma · joined April 27, 2019

submissionscomments
mathfailure··on Start all of your commands with a comma (2009)
> if you end up in a directory that's not under your control, and you do a "ls", it might execute "./ls" instead of /usr/bin/ls,

Not if if you APPEND the dot path to the PATH env: the system traverses the dirs specified in the PATH env from left to right and stops at first match. Your system's ls binary is in the dir that's to the left of your '.' dir.

mathfailure··on Start all of your commands with a comma (2009)
No, in fact he is correct: system scripts won't pick up your overrides configured via your shell's rc scripts.
mathfailure··on Start all of your commands with a comma (2009)
Because it's useless extra typing. People try to narrow commands down to two fucking chars and you suggest to type the whole goddamn path!
mathfailure··on Start all of your commands with a comma (2009)
Kinda makes no sense to me: so you don't use '--' as a prefix, you use it in the middle of an alias, so you first have to autocomplete, say, 'gi' not to 'git' but to 'git--progress'. What does that alias do? Doesn't it call git with some args? If so - why not just alias it to git?
mathfailure··on Start all of your commands with a comma (2009)
> I prefer giving scripts numbers instead of names

> Something like "[number"

> It contains 100s of short scripts

So you call scripts like [1 [2 [3 [4 ... and remember what each one of them does? If yes - that's nuts, I'd visit a doctor.

mathfailure··on Start all of your commands with a comma (2009)
People tend to want some separation between what's theirs and what's others. Other programs/scripts quite often put something into ~/.local/bin, so it's not yours actually, it's theirs.
mathfailure··on Start all of your commands with a comma (2009)
Ah, I see you're a man of culture as well!
mathfailure··on Start all of your commands with a comma (2009)
I like to follow my own convention where I name files with shell scripts with an extension: .sh for POSIX-compatible scripts, .bash for scripts with bashisms or .zsh for scripts with zshisms.

If I ever wanted to achieve what you initially wanted to achieve - I could use something like

alias -s sh=sh

alias -s bash=bash

alias -s zsh=zsh

Just like I do bind .txt and .conf to 'less', .pdf to 'qpdf', .json to 'ijq', video formats to 'mpv' and so on.

mathfailure··on Start all of your commands with a comma (2009)
One rarely actually needs to shadow binaries. Some cases could indeed be covered by introducing an alias that binds the binary's name to call a different copy of that binary.

You use shadowing to fix issues where you install some software that expects you to have a sane and ~recent version of some tool like git, but you don't as your system provides that binary and unfortunately it is either not sane (not GENERALLY sane [while it could be sane for system scripts]) or not recent enough. In that case the program's function would simply fail if it would call the system's binary and you shadow the binary with your version to fix that.

> adding your script directory in front of the PATH

That's a poor advice for the scripts you call relatively frequently. Instead, (as a general approach, we aren't discussing some particular script) don't use shadowing for scripts: just pick a non-conflicting script name and append the script's dir to $PATH.

mathfailure··on Start all of your commands with a comma (2009)
No, don't do that as a precaution. As others have already answered correctly - it's too late to worry about such things if a malicious agent has write access to your ${HOME} dir.
mathfailure··on Start all of your commands with a comma (2009)
Not really, since if one usually does that - they probably understand the possible consequences and don't shadow whatever they like, but do it carefully.

On MacOS I shadow that way just curl and git binaries to the versions installed from homebrew and nothing has broken (yet). I know that tar on MacOS is also a weirdo that I'd rather shadow with the homebrew's gtar, but their args are different and I of course understand that there's a high probability of something in system to be bound to mac's version of tar, so here I better remember to use 'sane' tar as gtar or use an alias (instead of shadowing the binary) for tar to use gtar (because aliases are for users, not for system scripts/processes).

And on my home desktop's Debian - I don't even use shadowing of binaries at all (never needed it).

Also, I just realized: I change PATH env via my shell's rc script (~/.zshrc), so I probably could worry even less about shadowing system binaries (like tar on MacOS) possibly breaking things.

mathfailure··on Start all of your commands with a comma (2009)
I never knew that what I've known as 'hotstrings' (since the AutoHotKey days) other sometimes also call 'text expanders'.
mathfailure··on Start all of your commands with a comma (2009)
Others have already given valid answers: grep is not ripgrep [their params don't match], so it's a bad idea to alias 'grep' to use ripgrep. But it's okay to alias 'ripgrep' (or 'rg' or whatever) to use ripgrep with some args.
mathfailure··on Start all of your commands with a comma (2009)
I didn't like the idea. I prefer the alternative approach: _I_ decide the order of dirs in the PATH env. If I introduce an executable with a name, that overrides a system one - I probably do that intentionally.

If I introduce an alias (like `grep='grep --binary-files=without-match --ignore-case --color=auto`) that matches the name of a system binary - I probably do that intentionally.

And if I EVER need to call grep without my alias - I just prefix it with a backslash: \grep will search with case sensitivity and no color and will scan binaries.

mathfailure··on LinkedIn checks for 2953 browser extensions
Surely they do! The data is in the public internets, aren't they?
mathfailure··on Show HN: NanoClaw – “Clawdbot” in 500 lines of TS with Apple container isolation
The 2. Thank you.
mathfailure··on Recent discoveries on the acquisition of the highest levels of human performance
This source is shit: it doesn't grant open access.
mathfailure··on ICE Is Going on a Surveillance Shopping Spree
What's the connection between the movie The Matrix and ICE?

Also, did the country truly survive just fine without it before that? Are you familiar with crime stats? Could you share the data on levels of crime carried by illegal immigrants over the years?

mathfailure··on ICE Is Going on a Surveillance Shopping Spree
There's nothing wrong with that if it's justified.
mathfailure··on ICE Is Going on a Surveillance Shopping Spree
You can also not kill any people and that will be absence of murder. That's not what is being discussed.
mathfailure··on Show HN: Hover – IDE style hover documentation on any webpage
It uses LLM under the hood. This is the bad part.
mathfailure··on Show HN: Witr – Explain why a process is running on your Linux system
No, it does not.
mathfailure··on WinApps: Run Windows apps as if they were a part of the native Linux OS
To pass through a GPU - you'd need an extra GPU then..?
mathfailure··on WinApps: Run Windows apps as if they were a part of the native Linux OS
As you can see - running the container doesn't work.
mathfailure··on WinApps: Run Windows apps as if they were a part of the native Linux OS
Does this even work?

podman run mcr.microsoft.com/windows:ltsc2019

Trying to pull mcr.microsoft.com/windows:ltsc2019...

Error: choosing an image from manifest list docker://mcr.microsoft.com/windows:ltsc2019: no image found in manifest list for architecture amd64, variant "", OS linux

mathfailure··on Same-day upstream Linux support for Snapdragon 8 Elite Gen 5
Does it even matter with such a logic?
mathfailure··on SSH3: Faster and rich secure shell using HTTP/3
The project is abandoned as well.
mathfailure··on That Secret Service SIM farm story is bogus
Doubt. What are post-USSR countries (except for Ukraine) where government detains lots of people who hasn't committed any crimes? How many people get wrongfully killed by cops in post-USSR countries? In U.S. that's like a sport for cops to find an excuse to unalive someone.

And what is democratic about the fact that majority of people votes for candidate A, yet candidate B becomes the president because... because it's people don't actually vote for president, they vote for someone who counts pro-some party and it's THEY who vote for president in the end. What's democratic about corruption being completely legal (lobbying)? Do you know a single post-USSR country where lobbying is legal? (Hell, how can it be legal at all? there's no distinction between lobbying and corruption, that's the same thing!)

mathfailure··on macOS Tahoe
> not knowing you can put your Applications folder in your Dock and use it as a start menu

Doesn't work for me (Sequoia 15.4)

mathfailure··on Show HN: Pbar.io – Distributed progress bars that work in terminals and browsers
Oh, it was an error on my side, the link actually works.

If you are happy to share the code - I think quite some people would be happy. The openness doesn't guarantee, but usually leads to better security, performance, etc.

It is very nice of you to provide such a service (and for free, as I see), but your docs says we, users, better not update stuff faster than once per second and that's quite a big limitation for some big companies with lots of processes to track (which probably can't be grouped together into a single batch update as your docs suggest to do).

← PreviousPage 2 of 9Next →