38 lines
751 B
Bash
38 lines
751 B
Bash
doasedit() {
|
|
(( ${+commands[doas]} )) || return 1
|
|
|
|
doas -L
|
|
|
|
doas cp /etc/doas.conf /tmp/doas.conf
|
|
doas $EDITOR /tmp/doas.conf
|
|
|
|
if doas doas -C /tmp/doas.conf; then
|
|
echo "ok"
|
|
doas mv /tmp/doas.conf /etc/doas.conf
|
|
else
|
|
echo "error"
|
|
fi
|
|
|
|
doas -L
|
|
}
|
|
|
|
get_ip() {
|
|
(( ${+commands[jq]} )) && local JQ="| jq"
|
|
local IP=""
|
|
local ARGS=""
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
[[ $1 == --ip ]] && IP="?ip=$2" && shift || ARGS="$ARGS $1"
|
|
shift
|
|
done
|
|
|
|
eval "curl $ARGS -fsSL 'https://ifconfig.co/json$IP' $JQ"
|
|
}
|
|
|
|
http() {
|
|
(( ${+commands[python]} )) || return 1
|
|
|
|
[[ $# -gt 0 ]] && local DIR="--directory $1"
|
|
eval "python -m http.server 8080 --bind 127.0.0.1 $DIR"
|
|
}
|