add top commands from history
This commit is contained in:
parent
9d24bf8cce
commit
8950d2dfd5
@ -44,3 +44,23 @@ function logtalk() {
|
|||||||
function archive() {
|
function archive() {
|
||||||
open -na "Google Chrome" --args "https://web.archive.org/web/*/$*"
|
open -na "Google Chrome" --args "https://web.archive.org/web/*/$*"
|
||||||
}
|
}
|
||||||
|
function git_listobjectsbysize() {
|
||||||
|
tempFile=$(mktemp)
|
||||||
|
IFS=$'\n'
|
||||||
|
for commitSHA1 in $(git rev-list --all); do
|
||||||
|
git ls-tree -r --long "$commitSHA1" >>"$tempFile"
|
||||||
|
done
|
||||||
|
|
||||||
|
# sort files by SHA1, de-dupe list and finally re-sort by filesize
|
||||||
|
sort --key 3 "$tempFile" | \
|
||||||
|
uniq | \
|
||||||
|
sort --key 4 --numeric-sort --reverse
|
||||||
|
# remove temp file
|
||||||
|
rm -f "$tempFile"
|
||||||
|
}
|
||||||
|
function top_commands() {
|
||||||
|
history 1 | cat | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a; }' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n50
|
||||||
|
}
|
||||||
|
function top_commands_full() {
|
||||||
|
history 1 | cat | sed 's/^[0-9 \t]*//g' | awk '{CMD[$0]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "%\t" a; }' | sort -nr | nl | head -n50
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user