[~] Refactor
This commit is contained in:
parent
2f7a8d221b
commit
0bfa206da4
1
d1/f1.sh
1
d1/f1.sh
@ -4,3 +4,4 @@ cp dotfiles/.local/bin/commands ~/.local/bin/commands
|
|||||||
mkdir -p ~/.sway
|
mkdir -p ~/.sway
|
||||||
cp dotfiles/.sway/config ~/.sway/config
|
cp dotfiles/.sway/config ~/.sway/config
|
||||||
cp dotfiles/.zshenv ~/.zshenv
|
cp dotfiles/.zshenv ~/.zshenv
|
||||||
|
cp dotfiles/.tmux.conf ~/.tmux.conf
|
||||||
|
@ -17,6 +17,17 @@ def player_metadata():
|
|||||||
except:
|
except:
|
||||||
continue
|
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):
|
def eternal_oom(memory_limit=None):
|
||||||
import signal
|
import signal
|
||||||
import os
|
import os
|
||||||
@ -29,7 +40,7 @@ def eternal_oom(memory_limit=None):
|
|||||||
if memory_limit is None:
|
if memory_limit is None:
|
||||||
memory_limit = 3 * 1024 * 1024
|
memory_limit = 3 * 1024 * 1024
|
||||||
assert isinstance(memory_limit, int) \
|
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
|
and memory_limit > 512 * 1024
|
||||||
|
|
||||||
def pandas_data_frame(lines, groups_regex, header_regex, extra_columns):
|
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 = memory_stats()['mem_used']
|
||||||
mem_used = int(f.read().decode('utf-8').splitlines()[1].strip().split()[2])
|
|
||||||
t5 = subprocess.check_output('ps -e -o pid,args', shell=True).decode('utf-8').splitlines()
|
t5 = subprocess.check_output('ps -e -o pid,args', shell=True).decode('utf-8').splitlines()
|
||||||
t6 = pandas_data_frame(
|
t6 = pandas_data_frame(
|
||||||
t5,
|
t5,
|
||||||
|
@ -31,3 +31,5 @@ set-option -ga terminal-overrides ",screen-256color:Tc"
|
|||||||
set-option -g pane-active-border-style "bg=#33dd44 fg=#ffffff"
|
set-option -g pane-active-border-style "bg=#33dd44 fg=#ffffff"
|
||||||
|
|
||||||
bind space display "Fuck!"
|
bind space display "Fuck!"
|
||||||
|
set-option -g set-titles on
|
||||||
|
set-option -g set-titles-string "#S / #W"
|
||||||
|
Loading…
Reference in New Issue
Block a user