# cat /tmp/mutt-w5m.html | lynx -dump -listonly -stdin | w3m -O utf-8 -T text/html -dump | less
m2w ()
{
local file;
if [[ -e "$1" ]]; then
file="$1";
echo "selected ${file@Q}";
else
select file in /tmp/mutt*.html quit;
do
case "$file" in
quit)
return
;;
*)
echo "selected ${file@Q}";
break
;;
esac;
done;
fi;
cat /tmp/mutt-w5m.html | lynx -dump -listonly -stdin | w3m -O utf-8 -T text/html -dump | less -R;
echo;
echo "now you can copy and paste as well as reassemble the link saved at your clipboard ...";
echo " quit with [Ctrl]-[D]";
cat > /dev/null
}
exec 99<>/dev/null
# ¡ ‼ ¿ ↦ … – — „ ›
# ± ½ ² ¶ bedingter Zeilentrenn:
# ¯ ´ ` ¸ ¨ ˆ ˆ ˇ ˙ ˚ ˜
# $'\u034f', ͏ ͏ combining grapheme joiner,
# \u200Di, - zero width joiner
# pkg: icu/libicu-devel, uconv -x any-nfc, uconv -x any-nfd $'a\314\204'
# ht2txt, get-utf-8 ($'\000\000') get-unicode-character($'\uXXXX', uU: 16/32bit)
help() {
echo "added makros: addgroups m2wl$lv(mail_as_html->web-links)$nv h2t gu8 guc gUc"
}
addgroups() {
local users groups prnGroups mode ichr echoprog IFS execcmd;
case "$1" in
-r) mode=replace; shift;; -a) mode=add;shift;; *);;
esac
if [[ -n "$1" && "${1#-}" = "$1" ]]; then users="$1";
else : 0; users=(elm bel); fi ; # could look up by a command like pwentry or sed/awk /etc/passwd
IFS=", \t\r\n" groups=(users,tty,lp,audio,video,dialout,netdev,printadmin,ctools,ntools,xgrp)
IFS=", " prnGroups="${groups[*]}"; #echo "$prnGroups"; return;
echoprog="set -x"; # set -v ... Was only at direct commmand entry of a login-user shell functional.
if [[ ${#users[@]} -gt 1 ]]; then
select user in "${users[@]}"; do
break;
done
elif [[ ${#users[@]} -eq 0 ]]; then
read -p "username of user to add groups to: " user;
else user="${users[0]}"
fi
execcmd() {
echo; echo "$hv${mode}ing groups$nv $prnGroups ${hv}to user$nv $user ...";
case "$mode" in
replace) ( eval "$echoprog"; usermod -G "$prnGroups" "$user"; );;
add) ( eval "$echoprog"; usermod -a -G "$prnGroups" "$user"; );;
esac || perror $? >&2
[[ -n "$echoprog" ]] && echo;
( eval "$echoprog"
SUDO_ASKPASS=/bin/false sudo -u "$user" --askpass id -a; )
[[ -n "$echoprog" ]] && echo;
}
# echo "$ichr"| od -An -txC >&2;
if [[ -n "$mode" ]]; then
execcmd;
else
( read -N 1 ichr; if [[ "$ichr" = $'\n' || -z "$ichr" ]]; then ichr=1; else read -n 4 -t 0; fi; echo "$ichr"; ) | select mode in "add $lv(default)$nv" replace; do mode="${mode% *}"
execcmd; break;
done
fi
set +x;
}
m2wl() { local file;
if [[ -e "$1" ]]; then
file="$1";
echo "selected ${file@Q}";
else
select file in /tmp/mutt*.html quit; do case "$file" in
quit) return;;
*) echo "selected ${file@Q}"; break;;
esac; done;
fi
cat "$file" | lynx -dump -listonly -stdin | w3m -O utf-8 -T text/html -dump | less
echo; echo "now you can copy and paste as well as reassemble the link saved at your clipboard ...";
echo " quit with [Ctrl]-[D]";
#cat >/dev/null
read clipme <( tail -n 1; ) && xsel -ip && echo "The last line of text input is now in the Windows-like clipboard selection,\n use at your favourite web browser with [Ctrl][V]" >&2
}
alias xman='man -TX100 -t'
man-lynx() { man -Thtml -t bash | lynx -stdin; }
man-w3m() { man -Thtml -t bash | w3m -T text/html -; }
man-less() { man -Ttext -t bash | less; }
mangrep() { srch="$@"; # needa see whether your man pages are also stored as .xz
for i in /usr/share/man/man[0-9]*/* /usr/local/share/man[0-9]*/*; do
# or use $MANPATH instead
xzgrep -i -H --label="${i##*/}" -m1 -o "[^ \t]*\<$srch\>[^ \t]*" <"$i";
done;
}
# urpmi groff-x11
# man -Tps -t sprintf | pstotext ... or use gs -Doutput=....
# man man; man info; man -a signal; man -k print
h2t() { echo "$@" | w3m -O utf-8 -T text/html -dump; }
gu8() { echo "$@" | w3m -O utf-8 -T text/html -dump | tr -d '\n'| od -An -toC; }
guc() { echo "$@" | w3m -O utf-8 -T text/html -dump | tr -d '\n'| iconv -f utf-8 -t utf-16 | od -An -j2 -txS; }
gUc() { echo "$@" | w3m -O utf-8 -T text/html -dump | tr -d '\n'| iconv -f utf-8 -t utf-32 | od -An -j4 -txI; }
alias more='less -R | more'
alias vless='vim -MR'
alias trz="tr '\000' '\n'"
alias odx='od -An -txC'
alias odc='od -An -tc'
alias odxc='od -An -txCc'
# ** Mageia Linux Distro package installation:
# urpmq -Y mime
# urpmq -i perl-MIME-tools
# urpmi perl-MIME-tools
# urpmff() { urpmf "$@" | grep bin/ | grep "/$@$"
# urpmff ded
# urpmi --auto-update & urpme pkg2uninstall & rpm -qa ... list installed pkgs
# export PYTHONPATH=/usr/local/lib/python3/
# bind '"\e[A": previous-history'
# bind '"\e[B": next-history'
#[[ $# -gt 1 ]] && exec "$@"
#set -m ... monitor mode: report exited jobs, by default on for interactive shells
#set -b/-o notify ... report terminated jobs immediately rather than before the next prompt
#set -v ... print shell input lines as they are read
#set -C ... refuse overwriting by >xx, need to use >|xx
#set -o history; # would use history even if #0 is not a tty
#set -u history; # unsets this option
alias xman=man -TX100 -t sprintf
man-w3m() { man -Thtml -t "$@" | w3m -T text/html -; }
man-lynx() { man -Thtml -t "$@" | lynx -stdin; }
mangrep() { srch="$@";
for i in /usr/share/man/man[0-9]*/* /usr/local/share/man[0-9]*/*; do
# your local man pages may not be in .xz-format!
xzgrep -i -H --label="${i##*/}" -m1 -o "[^ \t]*\<$srch\>[^ \t]*" <"$i";
done;
}
# man -Tps -t sprintf | pstotext ... or use gs -Doutput=...