+.config/yt-dlp.conf master
authorJan Kratochvil <jan@jankratochvil.net>
Fri, 19 Apr 2024 13:39:16 +0000 (21:39 +0800)
committerJan Kratochvil <jan@jankratochvil.net>
Fri, 19 Apr 2024 13:39:16 +0000 (21:39 +0800)
.config/yt-dlp.conf [new file with mode: 0644]
.vimrc
bin/hog [new file with mode: 0755]
bin/nn [new file with mode: 0755]
bin/psu

diff --git a/.config/yt-dlp.conf b/.config/yt-dlp.conf
new file mode 100644 (file)
index 0000000..ce0622d
--- /dev/null
@@ -0,0 +1 @@
+--restrict-filenames
diff --git a/.vimrc b/.vimrc
index e3dd08e..2322696 100644 (file)
--- a/.vimrc
+++ b/.vimrc
@@ -99,7 +99,9 @@ endif
 noremap! <Esc>[23~ <Nop>
 noremap <Esc>M :cn<cr>zz<C-g>
 noremap <Esc>L :cp<cr>zz<C-g>
-noremap <Esc>f "myiw:grep<Space>-Ew<Space>'<C-r>m'<Space>`git ls-files`
+" dnf install vim-fugitive
+noremap <Esc>f "myiw:Ggrep<Space>-Ew<Space>'<C-r>m'<Space>
+noremap <Esc>F "myiw:grep<Space>-Ew<Space>'<C-r>m'<Space>`git ls-files`
 noremap <Esc>g "myiw:grep<Space>-rEw<Space>'<C-r>m'<Space>.
 noremap <C-]> <C-]>zz<C-g>
 noremap <C-t> <C-t>zz<C-g>
diff --git a/bin/hog b/bin/hog
new file mode 100755 (executable)
index 0000000..4dd1017
--- /dev/null
+++ b/bin/hog
@@ -0,0 +1,19 @@
+#! /usr/bin/perl
+use strict;
+use warnings;
+my $psu=system($ENV{"HOME"}."/bin/psu")==0;
+local *F;
+open F,"/usr/bin/top -b -n2 -d1|" or die;
+my $top=0;
+while (<F>) {
+  /^top / && $top++;
+  /^$/ && $top++;
+  next if $top!=5;
+  /^(?:\s*\S+){8}\s*(\S+)\s*\S+\s*([^:\s]*):/ or next;
+  next if $1<90;          # CPU %
+  next if $2<($psu?30:1); # minutes it has run
+  tr/'//d;
+  system "DISPLAY=:0 xmessage -timeout 30 -default okay -center '$_' 2>/dev/null";
+  exit 0;
+}
+close F or die;
diff --git a/bin/nn b/bin/nn
new file mode 100755 (executable)
index 0000000..d8ce7f4
--- /dev/null
+++ b/bin/nn
@@ -0,0 +1,9 @@
+#! /bin/sh
+if [ -z "$*" ];then
+  echo >&2 "No PID"
+elif [ "$1" = "-p" ];then
+  shift
+  exec chrt -i -p 0 "$@"
+else
+  exec chrt -i 0 "$@"
+fi
diff --git a/bin/psu b/bin/psu
index 51cdf90..c8d9697 100755 (executable)
--- a/bin/psu
+++ b/bin/psu
@@ -1,4 +1,4 @@
 #! /bin/bash
-acpi|&grep -Eq 'Battery 0: Not charging|Battery 0: Charging|No support for device type: power_supply' || exit 1
-grpcurl -v -plaintext -d '{"get_status":{}}' 192.168.1.1:9000 SpaceX.API.Device.Device/Handle &>/dev/null || exit 1
+/usr/bin/acpi|&grep -Eq 'Battery 0: Not charging|Battery 0: Charging|No support for device type: power_supply' || exit 1
+/usr/bin/grpcurl -v -plaintext -d '{"get_status":{}}' 192.168.1.1:9000 SpaceX.API.Device.Device/Handle &>/dev/null || exit 1
 exit 0