From de9af63f490f2e07efde4ddb39500a2ca218cd5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jozef=20Steinh=C3=BCbl?= Date: Mon, 23 Dec 2024 11:35:33 +0100 Subject: [PATCH] feat: utils --- .local/bin/biggest_files | 3 +++ .local/bin/memory | 11 +++++++++++ goog | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100755 .local/bin/biggest_files create mode 100755 .local/bin/memory diff --git a/.local/bin/biggest_files b/.local/bin/biggest_files new file mode 100755 index 0000000..1167682 --- /dev/null +++ b/.local/bin/biggest_files @@ -0,0 +1,3 @@ +#!/bin/bash + +echo -e "Size\tPath" && du -ah . 2>/dev/null | sort -rh | head -n 20 diff --git a/.local/bin/memory b/.local/bin/memory new file mode 100755 index 0000000..cd7a79c --- /dev/null +++ b/.local/bin/memory @@ -0,0 +1,11 @@ +#!/bin/bash +program=$1 + +while true +do + ps -eo size,pid,user,command --sort -size | \ + awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' |\ + cut -d "" -f2 | cut -d "-" -f1 | grep "$program" | \ + awk '{print $0; sum+=$1} END {print "Total: " sum " Mb"}' + sleep 0.3 +done diff --git a/goog b/goog index 51cc097..0e3604e 100755 --- a/goog +++ b/goog @@ -11,7 +11,7 @@ stuff: list[str] = [ *expand("~/.config/{fish,kitty,nvim,pipewire,sway,swaylock,waybar,xdg-desktop-portal,zed}/**"), *expand("~/.config/vesktop/{settings,themes}/**"), "~/.icons/**", - *expand("~/.local/bin/{yarn}"), + *expand("~/.local/bin/{yarn,memory,biggest_files}"), ] options, _ = getopt(sys.argv[1:], "ds", ["dump", "sync"])