๐ฌ Discord: _Zen_#8361 talk to me เผผ ใค โ_โ เผฝใค
irevenko / tsukae Goto Github PK
View Code? Open in Web Editor NEW๐๐ Show off your most used shell commands
License: MIT License
๐๐ Show off your most used shell commands
License: MIT License
๐ฌ Discord: _Zen_#8361 talk to me เผผ ใค โ_โ เผฝใค
This line was creating problem for me.
Error message: panic: runtime error: index out of range [1] with length 1
changing
historySlice[i] = commandSlice[1] //writing command name after sudo
to
historySlice[i] = commandSlice[0] //writing command name after sudo
solved problem for me.
I don't have any programming language knowledge but i guess it's because of previous for loop, that remove timestamps.
Currently, it seems that only a handful of commands are shown. It would be useful to be able to set a variable number of commands, which are less useful for pie charts, but more useful for the list format.
Hi!
It will be great to have xonsh shell support.
The history backend in xonsh is customisable but it has two default backends to choose: json and sqlite.
How to create and get the data for two backends:
pip install xonsh # or install/docker ways: https://xon.sh/contents.html#installation
# Json
echo \$XONSH_HISTORY_BACKEND = \'json\' > /tmp/rc_json
xonsh --rc /tmp/rc_json
echo 1
echo 2
exit
cd ~/.local/share/xonsh/
cat xonsh-*.json | jq .data.cmds[].inp
# "echo 1\n"
# "echo 2\n"
# SQLite
echo \$XONSH_HISTORY_BACKEND = \'sqlite\' > /tmp/rc_sqlite
xonsh --rc /tmp/rc_sqlite
echo 1
echo 2
exit
pip install sqlite_web
sqlite_web ~/.local/share/xonsh/xonsh-history.sqlite
# http://127.0.0.1:8080/xonsh_history/query/
# SELECT * FROM "xonsh_history"
Thanks!
โฌ๏ธ Please click the ๐ reaction instead of leaving a +1
or ๐ comment
I would love to see a snap or .deb package of this for easy installation on my Ubuntu systems. ๐
There are two command-line tools, z
and zsh-z
, which keep track of your most-used and recently-used command-line DIRECTORIES (they say "frecency" for a mixture of frequently and recently) as opposed to tsukae's current display of just the commands.
z: https://github.com/rupa/z
zsh-z:https://github.com/agkozak/zsh-z
The way you use the tool is to source
a script that sets a hook that runs every time your prompt is displayed. You can then enter z foo
where foo
is a substring that is compared against your most 'frecently' used directories.
Unfortunately, z
is a shell function, not a callable program. However, its data is stored in ~/.z
, and looks like the details below. Note the path, its score, and the timestamp of access are all shown. This should be easy for tsukae to parse out, and offer a mode in addition to bash
and zsh
called z
. You'd want to show the highest-scored N entries in tsukae.
$ head ~/.z
/Users/zachriggle/gdb-build|2.95589|1614576609
/Applications/IDA Pro 7.5|1.21395|1612766077
/Users/zachriggle/ctf-solutions|25.2152|1614161190
/Users/zachriggle/autoprogram|13.8645|1614141904
/Users/zachriggle/pwntools/.git|3.31034|1614112324
/Users/zachriggle/ctf-solutions/defcon/2020/finals/gameboooy|2.3126|1596929922
/Users/zachriggle/ctf-solutions/defcon|1.93996|1614161192
/usr/local/Cellar|2.40773|1613560248
/Users/zachriggle/sphinx|5.51275|1613553642
/Users/zachriggle/usercorn|2.23848|1612281791
Disclaimer: I would implement this myself, but I am barred from FOSS contributions by my employer.
bash or zsh history files that have timestamps written into them cannot be parsed.
2021/03/03 14:19:20 <COMMANDS_NUMBER> must be an Integer
exit status 1
I would like to be able to pass certain commands to be ignored when displaying the charts, i.e. the number of times I invoke git
or ls
or cd
is not as important to me as other commands, but these are typically at the top of the charts, crowding them out. Maybe a command line option that takes one or more commands (or repeat the option) to be eliminated from the final list?
Cool project! Thanks for sharing. I have some ideas to improve the readme - I hope these are helpful.
Thanks!
It would be nice if this used HISTFILE to find the history file instead of assuming it's in the default path
Currently, tsukae lists commands from the entire history file.
It would be useful to see which commands were most used in the last (day, week, month).
This won't work for bash, but zsh puts timestamps in its history file.
Haven't tried it, but the readme only states zsh and bash
Not sure what the issue is, $HOME and $HISTFILE are all set correctly. The file is accessible and readable.
$ echo $HOME
/Users/heapcrash
$ echo $HISTFILE
/Users/heapcrash/.zhistory
$ tail -2 $HISTFILE
: 1614405148:0;echo $HISTFILE
: 1614405182:0;tail -2 $HISTFILE
$ go run main.go zsh
2021/02/27 00:52:12 Can't find or open /.zsh_history in: /Users/heapcrash
exit status 1
Tsukae is great and does right what it says on the tin. However, I don't necessarily care about my usage of e.g. cd
or echo
.
It would be nice if Tsukae had a configurable blacklist of commands to NOT show. Maybe have a list of commands to ignore in e.g. ~/.config/tsukae/blacklist
.
I am red-green colorblind, so it makes it very hard to distinguish between some of the sections in the pie chart mode. So first, it would be nice to be able to configure which colors are used (ANSI "green" and "yellow" are indistinguishable to me). There are a few colors that aren't used (and even then there's the bold variants and background-color variants).
For example, here I cannot tell the difference between the gc
and verify-fix
slices in this picture:
It would be nice to be able to specify the set of colors used by tsukae
.
It would be even better if tsukae were to support 256 colors, or even 24-bit color, since most terminals support this now. It seems there is even a Go package to provide this support, with https://github.com/gdamore/tcell.
You can check if your terminal supports 24-bit color with the following command:
awk 'BEGIN{
s="/\\/\\/\\/\\/\\"; s=s s s s s s s s;
for (colnum = 0; colnum<77; colnum++) {
r = 255-(colnum*255/76);
g = (colnum*510/76);
b = (colnum*255/76);
if (g>255) g = 510-g;
printf "\033[48;2;%d;%d;%dm", r,g,b;
printf "\033[38;2;%d;%d;%dm", 255-r,255-g,255-b;
printf "%s\033[0m", substr(s,colnum+1,1);
}
printf "\n";
}'
pwsh Log file:(Get-PSReadlineOption).HistorySavePath
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.