Live data from Hacker News

New(ish) command line tools

jvns.ca

141–150 of 252 posts

Re: New(ish) command line tools

#141
post #3

direnv is such a godsend that I shill for it on every team and in every company now, it's such a great tool.

I've actually moved from direnv to shadowenv[1]. It's more powerful since it's using a Lisp dialect called Shadowlisp that lets you easily do things like append/prepend to $PATH, expand paths and other common actions.

[1] https://shopify.github.io/shadowenv/

Re: New(ish) command line tools

#142

Ah, delta is missing! Right from the docs, it's "[a] syntax-highlighting pager for git, diff, and grep output". [1] https://github.com/dandavison/delta (edit: nevermind, somehow I missed it)

A-ha! I knew I had one more.

How many times have you wanted to dedup a (text) file, but definitely didn't have enough memory to perform the task? I found this one day when I had to dedup a set of .ndjson.gz files which totaled a cumulative 312 GBs. Utilizing the bloomfilter option, I was able to dedup the records without any large investment on my part.

Anyways, runiq[1], "[an] efficient way to filter duplicate lines from input, à la uniq".

It provides several ways to filter of which I almost always default to utilizing the bloomfilter implementation (`-f bloom`).

---

[1] https://github.com/whitfin/runiq

[2] https://whitfin.io/filtering-unique-logs-using-rust/

Re: New(ish) command line tools

#143
post #16

Glad to discover fd. I've always struggled with find syntax. It's easy enough, but always kind of fiddly IME.

I create aliases/functions and maintain a cheatsheet for commands I don't use often (for ex: convert/ffmpeg/etc) .

    # fs 'foo' will find files/dirs with 'foo' anywhere in the name irrespective of case
    fs() { find -iname '*'"$1"'*' ; }

Re: New(ish) command line tools

#144

I really like the approach of pipe-rename ( https://github.com/marcusbuffett/pipe-rename ) for renaming many files. It's especially convenient for people who can efficiently edit many lines in their favorite text editor (so everybody here, I guess). Main problem: you maybe don't do this kind of operation frequently enough to remember how it's called or how you aliased it.

Given that I'm guaranteed to forget that I have this thing installed if I would install it, I'm just going to steal the idea and try to remember to use my editor instead of an ugly shell loop next time I want to rename many files. There's only a small difference, really, between transforming `1.txt 2.txt 3.txt` to `file1.md file2.md file3.md` and transforming to `mv 1.txt file1.md; mv 2.txt file2.md; mv 3.txt file3.md`.

Re: New(ish) command line tools

#145

Has anyone made an installer/GNU type thing for the "common" ones like delta and rg? Could be a fun weekend project: Select what tooling you want, it will be installed using your package manager [ ] delta [ ] bat ...

You can use Nix (https://nixos.org/nix) to install these tools on any Mac/Linux machine (nix profile install nixpkgs#{bat, delta}). Disclaimer: I packaged some of these tools for Nix :)

Re: New(ish) command line tools

#146

I could really use a better workflow to refine grep matches. Has anyone made a tool that combines grep (regex search) with fzf (multiple positive/negative patterns)? What I really want is something like: grep pattern1 **/* | grep pattern2 | grep -v exclude_these | grep -v also_exclude The problem is this loses filenames and context lines in the output. I want to apply several positive and negative regexes, and only a…

If the first grep has "-HRn" flags you then pass the file and line number information down the pipeline.

  -H File name
  -R Recursive (directories)
  -n Line number

Re: New(ish) command line tools

#147

It's not new but I like "Miller": > Miller is a command-line tool for querying, shaping, and reformatting data files in various formats including CSV, TSV, JSON, and JSON Lines. https://miller.readthedocs.io/en/latest/

I got very excited about this tool. It's exactly what I need. I wrote a custom calendar app in it. But I got disappointed by performance. A list of 10 items takes 3 seconds to draw. I yet have to check if that is not caused by some other tool in the call stack. I wonder what is others people experience with performance of mlr?

Re: New(ish) command line tools

#148

I really like the approach of pipe-rename ( https://github.com/marcusbuffett/pipe-rename ) for renaming many files. It's especially convenient for people who can efficiently edit many lines in their favorite text editor (so everybody here, I guess). Main problem: you maybe don't do this kind of operation frequently enough to remember how it's called or how you aliased it.

Sounds a bit like vidir from moreutils.

Re: New(ish) command line tools

#149

I really like the approach of pipe-rename ( https://github.com/marcusbuffett/pipe-rename ) for renaming many files. It's especially convenient for people who can efficiently edit many lines in their favorite text editor (so everybody here, I guess). Main problem: you maybe don't do this kind of operation frequently enough to remember how it's called or how you aliased it.

It is a good approach. Emacs has dired and other modes for doing this.

Re: New(ish) command line tools

#150
post #13
post #6

Earlier quoted context omitted.

direnv should have been part of unix/linux/posix environments from the start. Whenever something's install steps tell you "go add this export statement to your .bashrc" or similar, it never sat well. That sort of thing should be scoped by path, and shell independent -- exactly the thing direnv enables.

The first thing I did recently in some cleanup work for a team was set up direnv and have it auto-switch kubernetes context by location.

I was reading the thread and thinking "this is a cool tool, might use someday".

>have it auto-switch kubernetes context by location

Now I'm sold, thanks!

Post reply on HN