diff --git a/d1/f1.sh b/d1/f1.sh index d4219fa..edb7227 100644 --- a/d1/f1.sh +++ b/d1/f1.sh @@ -4,3 +4,4 @@ cp dotfiles/.local/bin/commands ~/.local/bin/commands mkdir -p ~/.sway cp dotfiles/.sway/config ~/.sway/config cp dotfiles/.zshenv ~/.zshenv +cp dotfiles/.tmux.conf ~/.tmux.conf diff --git a/dotfiles/.local/bin/commands b/dotfiles/.local/bin/commands index 7c1e53b..947491e 100755 --- a/dotfiles/.local/bin/commands +++ b/dotfiles/.local/bin/commands @@ -17,6 +17,17 @@ def player_metadata(): except: continue +def memory_stats(): + with io.BytesIO(subprocess.check_output('free', shell=True)) as f: + t1 = f.read().decode('utf-8').splitlines() + mem_total = int(t1[1].strip().split()[1]) + mem_used = int(t1[1].strip().split()[2]) + + return dict( + mem_total=mem_total, + mem_used=mem_used, + ) + def eternal_oom(memory_limit=None): import signal import os @@ -29,7 +40,7 @@ def eternal_oom(memory_limit=None): if memory_limit is None: memory_limit = 3 * 1024 * 1024 assert isinstance(memory_limit, int) \ - and memory_limit < 6 * 1024 * 1024 \ + and memory_limit < memory_stats()['mem_total'] * 0.8 \ and memory_limit > 512 * 1024 def pandas_data_frame(lines, groups_regex, header_regex, extra_columns): @@ -185,8 +196,7 @@ def eternal_oom(memory_limit=None): ), ) - with io.BytesIO(subprocess.check_output('free', shell=True)) as f: - mem_used = int(f.read().decode('utf-8').splitlines()[1].strip().split()[2]) + mem_used = memory_stats()['mem_used'] t5 = subprocess.check_output('ps -e -o pid,args', shell=True).decode('utf-8').splitlines() t6 = pandas_data_frame( t5, diff --git a/dotfiles/.tmux.conf b/dotfiles/.tmux.conf index 1222549..84df809 100644 --- a/dotfiles/.tmux.conf +++ b/dotfiles/.tmux.conf @@ -31,3 +31,5 @@ set-option -ga terminal-overrides ",screen-256color:Tc" set-option -g pane-active-border-style "bg=#33dd44 fg=#ffffff" bind space display "Fuck!" +set-option -g set-titles on +set-option -g set-titles-string "#S / #W"