Upload files to ".local/bin"

This commit is contained in:
coast 2025-05-29 23:14:29 +02:00
parent e8a5ca8103
commit d17e02fa0f
3 changed files with 45 additions and 0 deletions

13
.local/bin/edsc Normal file
View file

@ -0,0 +1,13 @@
#!/bin/sh
if [ -z "$1" ]; then
SCRIPT=$(find . -type f | fzfse)
else
SCRIPT="$1"
fi
if [ -z "$SCRIPT" ]; then
echo 'Usage: edsc [file]'
exit 1
fi
emacsclient -c -nw "$SCRIPT"

3
.local/bin/fzfse Normal file
View file

@ -0,0 +1,3 @@
#!/bin/sh
fzf --layout=reverse --height 40%

29
.local/bin/sb-memory Normal file
View file

@ -0,0 +1,29 @@
#!/bin/sh
_openbsd() {
TOTAL="$(free | awk '/^Mem:/ {print $2}')"
MUSED="$(top -b -n 1 | grep -o 'Real.*' | sed 's/Real: //' | sed 's/\/.*//')"
printf "$MUSED" | egrep "[0-9]{4}" > /dev/null && FUSED="$(printf "$MUSED" | cut -c -2 | sed 's/./.&/2')G" || FUSED=$MUSED
printf "$FUSED/$TOTAL\n"
}
_freebsd() {
TOTAL="$(freecolor -om | awk '/^Mem:/ {print $2}')"
MUSED="$(freecolor -om | awk '/^Mem:/ {print $3}')"
printf "$MUSED" | egrep "[0-9]{4}" > /dev/null && FUSED="$(printf "$MUSED" | cut -c -2 | sed 's/./.&/2')G" || FUSED=""$MUSED"M"
printf "$TOTAL" | egrep "[0-9]{4}" > /dev/null && TOTAL="$(printf "$TOTAL" | cut -c -2 | sed 's/./.&/2')G" || FUSED=$TOTAL
printf "$FUSED/$TOTAL\n"
}
_linux() {
TOTAL="$(free -h | awk '/^Mem:/ {print $2}')"
MUSED="$(free -h | awk '/^Mem:/ {print $3}')"
printf "$MUSED" | grep "[0-9]{4}" > /dev/null && FUSED="$(printf "$MUSED" | cut -c -2 | sed 's/./.&/2')G" || FUSED=$MUSED
printf "$FUSED/$TOTAL\n" | sed 's/Gi/GB/g' | sed 's/Mi/MB/g'
}
case $(uname) in
Linux) _linux ;;
OpenBSD) _openbsd ;;
FreeBSD) _freebsd ;;
esac