mirror of
https://git.sr.ht/~coasteen/dotfiles
synced 2025-11-04 14:47:38 +01:00
Upload files to ".local/bin"
This commit is contained in:
parent
e8a5ca8103
commit
d17e02fa0f
3 changed files with 45 additions and 0 deletions
13
.local/bin/edsc
Normal file
13
.local/bin/edsc
Normal 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
3
.local/bin/fzfse
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
fzf --layout=reverse --height 40%
|
||||||
29
.local/bin/sb-memory
Normal file
29
.local/bin/sb-memory
Normal 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
|
||||||
Loading…
Add table
Reference in a new issue