alias rsync='rsync -avhu --progress --delete --partial --links'
alias fatsync='rsync -rvhu --progress --delete --partial' # for fat32

alias scp='scp -rp'

alias pign=ping
alias nsl=nslookup

alias p8='ping 8.8.8.8'
alias p1='ping 1.1.1.1'

alias ssh='TERM=xterm-256color ssh'

alias {vssh,vissh}='${EDITOR:-vi} ~/.ssh/config'

# scan for open ports
alias portscan='nmap -sT'

flushdns() {
    if command -v resolvectl > /dev/null ; then
        resolvectl flush-caches
    elif command -v rc-service >/dev/null && command -v dnsmasq >/dev/null ; then
        doas rc-service dnsmasq restart
    fi
}

wtf() {
    w3m -dump https://wtfismyip.com/json | jq -r
}

# grab urls of any running processes
# see: http://github.com/mitchweaver/bin for urls script
psurls() { ps -auxww | urls ; }

isconnected() {
    if ifconfig $int | grep 'no network' >/dev/null ; then
        return 1
    fi
}

# systemd-resolved
alias resolved-status="systemd-resolve --status"
alias resolved-statistics="systemd-resolve --statistics"
alias resolved-write="pkill -USR1 systemd-resolve"
alias resolved-flush="resolvectl flush-caches"

dl() {
    if [ "$2" ] ; then
        wget -nv -c --no-cookies --no-hsts "$1" -O "$2"
    elif [ "$1" ] ; then
        wget -nv -c --no-cookies --no-hsts "$1"
    fi
}

# ========================================================================
# WPA_SUPPLICANT
# ========================================================================
alias wpscan='doas wpa_cli scan'

# ========================================================================
# TOR
# ========================================================================
alias torsocks='torsocks -i'
alias torshell='torsocks -i --shell'
alias torcheck='curl -x socks5h://localhost:9050 -s https://check.torproject.org | lynx -dump -stdin'
alias torget='torsocks -i wget'

# ========================================================================
# wireguard
# ========================================================================
alias wg-up='wg-quick up /etc/wireguard/wvr.sh.conf'
alias wg-down='wg-quick down /etc/wireguard/wvr.sh.conf'

