Re:Show HN: McFly, a smart Bash history search CLI in Rust w...
by asicsp on Tuesday December 04, 2018 @06:51AM
(#18598565)
I rarely use ctrl+r, because most of the time I'm searching based on command name, which is at the start (unless it is in pipeline, etc).. so, I use this instead in `.inputrc`:
# use up and down arrow to match search history based on typed starting text
"\e[A": history-search-backward
"\e[B": history-search-forward
Re:Show HN: McFly, a smart Bash history search CLI in Rust w...
by 0db532a0 on Tuesday December 04, 2018 @06:58AM
(#18598600)
This is actually a general feature of the GNU readline library, which a lot of programmes including bash use. For instance, a lot of REPLs like ghci use it.
Re:Show HN: McFly, a smart Bash history search CLI in Rust w...
by jaster on Tuesday December 04, 2018 @05:10AM
(#18598051)
Additional tip: if you overshoot and miss the command you wanted by hitting ctrl+R too much times (as it happens sometime when looking for an older command), you can go forward with ctrl+S. [EDIT: As Hikikomori pointed (thanks!), I got my shortcuts mixed up, ctrl+S is the shortcut for zsh, and the equivalent for bash is ctrl+shift+R]
(ctrl+S and ctrl+R are based on emacs shortcuts, where ctrl+S is search and ctrl+R is reverse search)
Re:Show HN: McFly, a smart Bash history search CLI in Rust w...
by rane on Tuesday December 04, 2018 @04:53AM
(#18597968)
For zsh, zaw[1]'s history is insanely useful. I don't really think a neural network is needed. Usually I get to the exact line I wanted with a few keystrokes.
Re:Show HN: McFly, a smart Bash history search CLI in Rust w...
by bhargav_ on Monday December 03, 2018 @06:22PM
(#18594214)
This is such a cool project! Plus a pretty awesome example of using Rust for CLI's. I'm curious about the neural network though. Is that also written in Rust? Or are you embedding something else?
Re:Show HN: McFly, a smart Bash history search CLI in Rust w...
by bhargav_ on Monday December 03, 2018 @07:19PM
(#18594610)
Just saw the implementation. It's goes a little over my head unfortunately, but I am curious about the affects of it. Did you compare the non-neural net version with the neural net version? If so what differences did you find?
Re:Show HN: McFly, a smart Bash history search CLI in Rust w...
by tectonic on Monday December 03, 2018 @07:25PM
(#18594644)
I found that the neural network does a little better than a simple linear regression function for weighting the parameters. I train it on a few months of my own shell history to predict, based on the last commands, what I'll type next.
Re:Show HN: McFly, a smart Bash history search CLI in Rust w...
by president on Monday December 17, 2018 @03:00PM
(#18701667)
Cool project and well executed. My only complaints are:
1. The GUI should display at the bottom of the screen rather than at the top. I found myself constantly having to jump my eyes from the bottom of the terminal where my command was, to the top of the screen.
2. Show the full commands in the search results. Maybe they could be wrapped? Long commands with changes towards the end of the string get chopped off making it hard to know the differences between them in the display.
Re:Show HN: McFly, a smart Bash history search CLI in Rust w...
by gojomo on Monday December 03, 2018 @11:06PM
(#18596138)
Nifty! Is the neural network constantly being adjusted from the user's own patterns of history re-use?
This also reminds me of one of my dream features for a shell: full dataflow input/output/provenance histories, on a per-file(-version) basis.
For example: show all the commands a certain file has been read from, show the command(s) that wrote to a file, show true steps by which a certain file was constructed from predecessor files/commands, etc.
Re:Show HN: McFly, a smart Bash history search CLI in Rust w...
by 2bitencryption on Tuesday December 04, 2018 @02:49AM
(#18597229)
this is a really nice example of a simple, practical, "non-deep" NN. I'm wondering, are there any good learning resources you could recommend to start a project like this?
It makes me want to try a personal project that makes use of a tiny light-weight NN as well. I see giant AlphaGo neural nets mentioned so frequently that I forgot they could be lean :)
Re:Show HN: McFly, a smart Bash history search CLI in Rust w...
by tectonic on Tuesday December 04, 2018 @12:37PM
(#18601621)
I read some tutorials on back propagation for this, but if you want to get into ML in general, I highly recommend fast.ai and Andrew Ng's free Stanford ML course.
Re:Show HN: McFly, a smart Bash history search CLI in Rust w...
by 0db532a0 on Tuesday December 04, 2018 @07:06AM
(#18598645)
I’m still quite new to neural networks. Can you explain the material benefit to using a neural network over a priority queue with a similar weighting system? Are you giving any other input to the neural network than simply the metrics you listed?
P.S. e.g. a polynomial over the metrics.
P.P.S. I imagine you’re using the neural network to tune the weights?
Re:Show HN: McFly, a smart Bash history search CLI in Rust w...
by tectonic on Tuesday December 04, 2018 @12:37PM
(#18601607)
I started with a list of commands prioritized by a linear function of the metrics listed. It did okay, but since I was learning the linear function with back propagation, I figured a "real" network would do slightly better, and it seems to (but possibly only slightly).
Re:Show HN: McFly, a smart Bash history search CLI in Rust w...
by tectonic on Tuesday December 04, 2018 @01:49PM
(#18602414)
Rather, the first one was simply a single node linear perceptron (a linear function) that I trained with backprop because I could, even though there are better techniques for fitting a linear function. Now that it's a "real" network, backprop is appropriate.
Re:Show HN: McFly, a smart Bash history search CLI in Rust w...
by tectonic on Tuesday December 04, 2018 @12:35PM
(#18601598)
Sorry, I agree that was confusing. Online learning is a term in ML for when you train a model incrementally over time. McFly won't connect to the Internet.
Re:Show HN: McFly, a smart Bash history search CLI in Rust w...
by craftyguy on Tuesday December 04, 2018 @12:43PM
(#18601685)
Ah, thanks for the clarification! To a non-ML person, this brought back memories of what Canonical was trying to do with search functionality on Ubuntu, by fetching ads over the internet to interleve in local search results.
https://linux.die.net/man/3/readline
https://tiswww.cwru.edu/php/chet/readline/rltop.html
(ctrl+S and ctrl+R are based on emacs shortcuts, where ctrl+S is search and ctrl+R is reverse search)
ctrl+shift+r works though.
(Not sure why bash did not go the obvious route here, I guess they already had something on ctrl+S when they implemented forward search...)
EDIT: actually, you can activate ctrl+S for search-foward on bash by using `stty -ixon`. See more info about why here https://unix.stackexchange.com/questions/141422/searching-hi...
https://en.wikipedia.org/wiki/Software_flow_control
https://github.com/junegunn/fzf/wiki/Examples#command-histor...
[1]: https://github.com/zsh-users/zaw
PROMPT_COMMAND="__last_exit=\$?;history -a \$MCFLY_HISTORY;mcfly add --exit \$__last_exit --append-to-histfile;history -cr \$MCFLY_HISTORY;${PROMPT_COMMAND}"
Felt good finally writing some code in Rust after the rust lang book.
1. The GUI should display at the bottom of the screen rather than at the top. I found myself constantly having to jump my eyes from the bottom of the terminal where my command was, to the top of the screen.
2. Show the full commands in the search results. Maybe they could be wrapped? Long commands with changes towards the end of the string get chopped off making it hard to know the differences between them in the display.
This also reminds me of one of my dream features for a shell: full dataflow input/output/provenance histories, on a per-file(-version) basis.
For example: show all the commands a certain file has been read from, show the command(s) that wrote to a file, show true steps by which a certain file was constructed from predecessor files/commands, etc.
It makes me want to try a personal project that makes use of a tiny light-weight NN as well. I see giant AlphaGo neural nets mentioned so frequently that I forgot they could be lean :)
P.S. e.g. a polynomial over the metrics. P.P.S. I imagine you’re using the neural network to tune the weights?
From what source? Do users need to worry about people gaming this to have ads show up in results?
http://www.arewelearningyet.com/
thought I'd share in case you/others wanted to avoid coding their own or experiment quickly with other types of models.