iankelling.org
/
git
/
distro-setup
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mostly fixes
[distro-setup]
/
brc
diff --git
a/brc
b/brc
index c9cd4fcee4af66f81029ec406f6007de50d9ae0a..02ad1a67b78073f1cb58f6bac878d3e64def4582 100644
(file)
--- a/
brc
+++ b/
brc
@@
-466,6
+466,10
@@
c() {
}
ccomp cd c
}
ccomp cd c
+bwm() {
+ s bwm-ng -T avg -d
+}
+
b() {
local topb
if (( ${#_iankdirb[@]} == 0 )); then
b() {
local topb
if (( ${#_iankdirb[@]} == 0 )); then
@@
-683,7
+687,7
@@
chrbind() {
chumount() {
local d
# dev/pts needed for pacman signature check
chumount() {
local d
# dev/pts needed for pacman signature check
- for d in dev
proc sys dev/pt
s; do
+ for d in dev
/pts dev proc sy
s; do
[[ -d $d ]]
if mountpoint $d &>/dev/null; then
m s umount $d
[[ -d $d ]]
if mountpoint $d &>/dev/null; then
m s umount $d
@@
-779,6
+783,19
@@
despace() {
done
}
done
}
+# get ipv4 ip from HOST. or if it is already a number, return that
+hostip() {
+ local host="$1"
+ case $host in
+ [0-9:])
+ echo "$host"
+ ;;
+ *)
+ getent ahostsv4 "$host" | awk '{ print $1 }' | head -n1
+ ;;
+ esac
+}
+
dig() {
command dig +nostats +nocmd "$@"
}
dig() {
command dig +nostats +nocmd "$@"
}
@@
-816,7
+833,10
@@
digdiff() {
dt() {
date "+%A, %B %d, %r" "$@"
}
dt() {
date "+%A, %B %d, %r" "$@"
}
-ccomp date dt
+dtr() {
+ date -R "$@"
+}
+ccomp date dt dtr
dus() { # du, sorted, default arg of
du -sh ${@:-*} | sort -h
dus() { # du, sorted, default arg of
du -sh ${@:-*} | sort -h
@@
-824,7
+844,7
@@
dus() { # du, sorted, default arg of
ccomp du dus
ccomp du dus
-e() {
echo "$@
"; }
+e() {
printf "%s\n" "$*
"; }
# echo args
ea() {
# echo args
ea() {
@@
-860,7
+880,11
@@
ediff() {
etail() {
tail -F /var/log/exim4/mainlog -n 200 "$@"
}
etail() {
tail -F /var/log/exim4/mainlog -n 200 "$@"
}
-ccomp tail etail
+etail2() {
+ tail -F /var/log/exim4/mymain -n 200 "$@"
+}
+
+ccomp tail etail etail2
# print exim old pids
eoldpids() {
# print exim old pids
eoldpids() {
@@
-920,14
+944,18
@@
eless() {
}
ccomp less eless
eqcat() {
}
ccomp less eless
eqcat() {
- exiqgrep -i -o 60 | while read -r i; do
+ exiqgrep -i
r.\*
-o 60 | while read -r i; do
hlm exim -Mvc $i
echo
hlm exigrep $i /var/log/exim4/mainlog | cat ||:
done
}
eqrmf() {
hlm exim -Mvc $i
echo
hlm exigrep $i /var/log/exim4/mainlog | cat ||:
done
}
eqrmf() {
- exiqgrep -i | xargs exim -Mrm
+ # other ways to get the list of message ids:
+ # exim -bp | awk 'NF == 4 {print $3}'
+ # # this is slower 160ms, vs 60.
+ # exipick -i
+ exiqgrep -ir.\* | xargs exim -Mrm
}
econfdevnew() {
}
econfdevnew() {
@@
-960,6
+988,14
@@
faf() { # find all files. use -L to follow symlinks
-o -name .undo-tree-history -prune \) -type f 2>/dev/null
}
-o -name .undo-tree-history -prune \) -type f 2>/dev/null
}
+# full path without resolving symlinks
+fp() {
+ local dir base
+ base="${1##*/}"
+ dir="${1%$base}"
+ printf "%s/%s\n" $(cd $dir; pwd) "$base"
+}
+
# mail related
frozen() {
# mail related
frozen() {
@@
-1371,7
+1407,15
@@
nags() {
}
nmt() {
}
nmt() {
- s nmtui-connect "$@"
+ # cant use s because sudo -i doesnt work for passwordless sudo command
+ case $EUID in
+ 0)
+ sudo nmtui-connect "$@"
+ ;;
+ *)
+ nmtui-connect "$@"
+ ;;
+ esac
}
nopanic() {
}
nopanic() {
@@
-1539,7
+1583,7
@@
resolvcat() {
grep '^ *hosts:' /etc/nsswitch.conf
if systemctl is-enabled systemd-resolved &>/dev/null || [[ $(systemctl is-active systemd-resolved ||:) != inactive ]]; then
hr; m ser status systemd-resolved | cat || :
grep '^ *hosts:' /etc/nsswitch.conf
if systemctl is-enabled systemd-resolved &>/dev/null || [[ $(systemctl is-active systemd-resolved ||:) != inactive ]]; then
hr; m ser status systemd-resolved | cat || :
- hr; m
systemd-resolve --
status | cat
+ hr; m
resolvectl
status | cat
fi
}
fi
}
@@
-1696,7
+1740,7
@@
sk() {
local quotes others
quotes=2048,2068,2086,2206
local quotes others
quotes=2048,2068,2086,2206
- others=2029,2033,2164
+ others=2029,2033,2
054,2
164
shellcheck -W 999 -x -e $quotes,$others "$@" || return $?
}
shellcheck -W 999 -x -e $quotes,$others "$@" || return $?
}
@@
-2139,6
+2183,23
@@
s/^\Wcapability: (.*)/\1/;Ta;h;b
"|sort -r
}
"|sort -r
}
+# Run script by copying it to a temporary location first,
+# and changing directory, so we don't have any open
+# directories or files that could cause problems when
+# remounting.
+z() {
+ local tmp
+ tmp=$(type -p "$1")
+ if [[ $tmp ]]; then
+ cd $(mktemp -d)
+ cp -a "$tmp" .
+ shift
+ ./"${tmp##*/}" "$@"
+ else
+ "$@"
+ fi
+}
+
# * misc stuff
# * misc stuff