From e859709cec1475d3ef14aca59e9c8343cc598a56 Mon Sep 17 00:00:00 2001 From: pika Date: Mon, 17 Mar 2025 11:37:05 +0100 Subject: [PATCH] addet: zprofile --- .zprofile | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .zprofile diff --git a/.zprofile b/.zprofile new file mode 100644 index 0000000..a18729e --- /dev/null +++ b/.zprofile @@ -0,0 +1,34 @@ +# ─< proxy config >─────────────────────────────────────────────────────────────────────── +proxy() { + case "$1" in + --show) + echo {"http: $http_proxy, $HTTP_PROXY" + "https: $https_proxy, $HTTPS_PROXY"} + ;; + *) + echo "You entered something wrong!" + ;; + esac + + local ip="172.22.11.69" + local port="8080" + + # Check if the IP and port are reachable + if nc -z -w5 $ip $port; then + # If reachable, set the proxy environment variables + export http_proxy="http://$ip:$port" + export https_proxy="http://$ip:$port" + export HTTP_PROXY="http://$ip:$port" + export HTTPS_PROXY="http://$ip:$port" + echo_info "Proxy set to: http://$ip:$port" || echo "Proxy set to: http://$ip:$port" + else + echo_error "IP $ip with port $port is not reachable." || echo "IP $ip with port $port is not reachable." + fi + + alias proxy='echo "http: $HTTP_PROXY"; echo "https: $HTTPS_PROXY"' +} + +# ─< unset proxy >──────────────────────────────────────────────────────────────────────── +noproxy() { + unset {HTTP_PROXY,HTTPS_PROXY,http_proxy,https_proxy} +}