Live data from Hacker News

Command line tools for productive programmers

earthly.dev

81–90 of 143 posts

Re: Command line tools for productive programmers

#81

Earlier quoted context omitted.

I have no dog in this fight (I use both Linux and macOS as daily drivers) but it could be argued that macOS has more of a claim to be Unix than Linux since the foundation of macOS comes from NeXTSTEP and FreeBSD whose codebases both ultimately descend from the original Bell Labs Unix, whereas Linux started life completely independently. I'd argue that Linux is more Unixy than macOS in terms of philosophy though, I re…

OSx is also Unix certified by the open group, along with hp-ux and aix. https://www.opengroup.org/openbrand/register/

There is a Linux distro in that list, too: Huawei's EulerOS, based on CentOS.

Re: Command line tools for productive programmers

#82

I would suggest https://rubygems.org/gems/ruby-each-line-2 e.g. ps -A | grep ruby | grep fsevent | ruby-each-line "puts l.split.first" | xargs kill -9 cat c | ruby-each-line "puts l.split.first[0..-2]" >> .env.development pbpaste | ruby-each-line "puts l.split.last" | ruby-all-lines "puts lines.map(&:strip).join(',')"

I don't want to be That Guy who says his way is best but I can only really see this being useful for someone who knows no shell tools at all. > ps -A | grep ruby | grep fsevent | ruby-each-line "puts l.split.first" | xargs kill -9 killall -9 -r ruby.\*fsevent > cat c | ruby-each-line "puts l.split.first[0..-2]" >> .env.development awk '{ print(substr($1, 0, length($1) - 1)) }' c >> .env.development or awk '{ print $1…

That first pkill/killall example is a bit silly, but for the others I can see how a "ruby-each-line" can be useful, especially if you're already familiar with Ruby (although I'd probably name it "el", as that's much less typing). I never really learned awk properly myself either, in spite of being quite familiar with most other shell tools. "ruby-each-line" does more or less the same thing as awk.

After all, there's just one person using your shell: you. So whatever works well for you is a "good" solution.

Re: Command line tools for productive programmers

#83
post #36

I can't sing the praises enough of entr. Just check out its man page: http://eradman.com/entrproject/ entr lets you watch files and re-run a command any time they change. Whenever I'm working on a script, or go tests, or whatever test-like thing I'm doing that's not in its own bloated test harness, I reach for entr. Great software, does what it's supposed to every time.

There is also `watchexec` [1]. However I don't know how it compares to `entr` or other inotify clients.

[1] : https://github.com/watchexec/watchexec

Re: Command line tools for productive programmers

#84
post #52
post #36

I can't sing the praises enough of entr. Just check out its man page: http://eradman.com/entrproject/ entr lets you watch files and re-run a command any time they change. Whenever I'm working on a script, or go tests, or whatever test-like thing I'm doing that's not in its own bloated test harness, I reach for entr. Great software, does what it's supposed to every time.

I used to use entr extensively for Sketch plugin development (the vector editing tool by Bohemian Coding). However the app used to crash randomly and I felt my plugin was causing it. I spent an inordinate amount of time trying to debug it, replacing libraries, changing code and so on. Thankfully I noticed at some point that the app was behaving well for long durations of time when I started it without entr. I got rid…

it looks like entr does a bunch of weird, potentially incompatible things, like redirecting stdin from /dev/tty and leaving FDs open in the child. however, my guess is that your build process is non-atomic, and your program is crashing due to necessary files being partially updated. this could probably be hacked around by doing something like `entr /bin/sh -c "sleep 1; exec realcommand"`.

Re: Command line tools for productive programmers

#85
I use "ESC-c" a lot. It calls fzf and fd, you type a part of your directory name, hit enter, and it cd's to that directory.

    export FZF_ALT_C_COMMAND='fd --type directory'
That's in my .zshenv.

It's incredibly useful if you have multi-layered project directories. Like ~/Projects/Terraform/Cool_Project - you'd hit esc-c, type cool, hit enter and you're in the place you wanted to be.

Re: Command line tools for productive programmers

#86
post #70

Author here. Thanks for sharing! Have you seen gron[1]? It can't do everything that jq can, but it is much more in the unix philosophy than jq. It simply flattens and unflattens json out into lines so you can use standard unix tools on it. ▶ gron "https://api.github.com/repos/tomnomnom/gron/commits?per_page=1" | fgrep "commit.author" json[0].commit.author = {}; json[0].commit.author.date = "2016-07-02T10:51:21Z"; jso…

That looks really useful, thank you. Plus when you use it, you can chant "GRON. GRON" like you're an Orc about to attack Minas Tirith!

Re: Command line tools for productive programmers

#87

Fzf is one of those tools that instantly makes you shell feel magical to use. I highly recommend it, and I consider it by far the most useful in this list!

I am sorry for spamming this comment, but I wanted to share it with all the fzf users because I found it so game-changing:

I use "ESC-c" a lot. It calls fzf and fd, you type a part of your directory name, hit enter, and it cd's to that directory.

    export FZF_ALT_C_COMMAND='fd --type directory'
That's in my .zshenv.

It's incredibly useful if you have multi-layered project directories. Like ~/Projects/Terraform/Cool_Project - you'd hit esc-c, type cool, hit enter and you're in the place you wanted to be.

Re: Command line tools for productive programmers

#88
post #70

Author here. Thanks for sharing! Have you seen gron[1]? It can't do everything that jq can, but it is much more in the unix philosophy than jq. It simply flattens and unflattens json out into lines so you can use standard unix tools on it. ▶ gron "https://api.github.com/repos/tomnomnom/gron/commits?per_page=1" | fgrep "commit.author" json[0].commit.author = {}; json[0].commit.author.date = "2016-07-02T10:51:21Z"; jso…

also, have you seen this fzf "trick"?

I am sorry for spamming this comment, but I wanted to share it with all the fzf users because I found it so game-changing:

I use "ESC-c" a lot. It calls fzf and fd, you type a part of your directory name, hit enter, and it cd's to that directory.

    export FZF_ALT_C_COMMAND='fd --type directory'
That's in my .zshenv.

It's incredibly useful if you have multi-layered project directories. Like ~/Projects/Terraform/Cool_Project - you'd hit esc-c, type cool, hit enter and you're in the place you wanted to be.

Re: Command line tools for productive programmers

#89
post #70

Author here. Thanks for sharing! Have you seen gron[1]? It can't do everything that jq can, but it is much more in the unix philosophy than jq. It simply flattens and unflattens json out into lines so you can use standard unix tools on it. ▶ gron "https://api.github.com/repos/tomnomnom/gron/commits?per_page=1" | fgrep "commit.author" json[0].commit.author = {}; json[0].commit.author.date = "2016-07-02T10:51:21Z"; jso…

also, have you seen this fzf "trick"? I am sorry for spamming this comment, but I wanted to share it with all the fzf users because I found it so game-changing: I use "ESC-c" a lot. It calls fzf and fd, you type a part of your directory name, hit enter, and it cd's to that directory. export FZF_ALT_C_COMMAND='fd --type directory' That's in my .zshenv. It's incredibly useful if you have multi-layered project directori…

Very cool! I use zoxide as a alias for cd to do this. But it only really works if you have cded using the full path in the past. But usually I have.

Re: Command line tools for productive programmers

#90
post #89

Earlier quoted context omitted.

also, have you seen this fzf "trick"? I am sorry for spamming this comment, but I wanted to share it with all the fzf users because I found it so game-changing: I use "ESC-c" a lot. It calls fzf and fd, you type a part of your directory name, hit enter, and it cd's to that directory. export FZF_ALT_C_COMMAND='fd --type directory' That's in my .zshenv. It's incredibly useful if you have multi-layered project directori…

Very cool! I use zoxide as a alias for cd to do this. But it only really works if you have cded using the full path in the past. But usually I have.

In the same vein I use autojump, and combined with ranger using the ranger-autojump plugin I can CD in any folder I have previously visited.
Post reply on HN