29 lines
617 B
Bash
29 lines
617 B
Bash
doasedit() {
|
|
(( ${+commands[doas]} )) || return 1
|
|
|
|
doas -L
|
|
doas $EDITOR /etc/doas.conf
|
|
doas doas -C /etc/doas.conf && echo "ok" || echo "error"
|
|
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"
|
|
}
|