Rename my Mac;

Add comfort Proxy, git functions;
Add macnst function
This commit is contained in:
Philip Henning 2023-02-07 14:11:35 +01:00
parent 3bfe88db50
commit fa4a927b5f
3 changed files with 53 additions and 7 deletions

View file

@ -259,7 +259,7 @@ profiles:
- f_c3mpv - f_c3mpv
- f_c3check - f_c3check
- f_zprofile - f_zprofile
VWAGWOY00349: WVDEWOBMC001307:
dotfiles: dotfiles:
- f_vimrc - f_vimrc
- f_zshrc - f_zshrc

View file

@ -1,4 +1,4 @@
{%@@ if profile == 'VWAGWOY00349' @@%} {%@@ if profile == 'WVDEWOBMC001307' @@%}
# Fig pre block. Keep at the top of this file. # Fig pre block. Keep at the top of this file.
[[ -f "$HOME/.fig/shell/zprofile.pre.zsh" ]] && . "$HOME/.fig/shell/zprofile.pre.zsh" [[ -f "$HOME/.fig/shell/zprofile.pre.zsh" ]] && . "$HOME/.fig/shell/zprofile.pre.zsh"
{%@@ endif @@%} {%@@ endif @@%}
@ -14,7 +14,7 @@ export VISUAL
EDITOR='vim' EDITOR='vim'
export EDITOR export EDITOR
{%@@ if profile == 'VWAGWOY00349' @@%} {%@@ if profile == 'WVDEWOBMC001307' @@%}
[[ $(command -v /opt/homebrew/bin/brew) ]] && eval "$(/opt/homebrew/bin/brew shellenv)" [[ $(command -v /opt/homebrew/bin/brew) ]] && eval "$(/opt/homebrew/bin/brew shellenv)"
# Added by Toolbox App # Added by Toolbox App
@ -42,7 +42,7 @@ export XDG_CONFIG_HOME
wsl.exe -d wsl-vpnkit service wsl-vpnkit start wsl.exe -d wsl-vpnkit service wsl-vpnkit start
{%@@ endif @@%} {%@@ endif @@%}
{%@@ if profile == 'VWAGWOY00349' @@%} {%@@ if profile == 'WVDEWOBMC001307' @@%}
# Fig post block. Keep at the bottom of this file. # Fig post block. Keep at the bottom of this file.
[[ -f "$HOME/.fig/shell/zprofile.post.zsh" ]] && . "$HOME/.fig/shell/zprofile.post.zsh" [[ -f "$HOME/.fig/shell/zprofile.post.zsh" ]] && . "$HOME/.fig/shell/zprofile.post.zsh"
{%@@ endif @@%} {%@@ endif @@%}

View file

@ -1,4 +1,4 @@
{%@@ if profile == 'VWAGWOY00349' @@%} {%@@ if profile == 'WVDEWOBMC001307' @@%}
# Fig pre block. Keep at the top of this file. # Fig pre block. Keep at the top of this file.
[[ -f "$HOME/.fig/shell/zshrc.pre.zsh" ]] && . "$HOME/.fig/shell/zshrc.pre.zsh" [[ -f "$HOME/.fig/shell/zshrc.pre.zsh" ]] && . "$HOME/.fig/shell/zshrc.pre.zsh"
{%@@ endif @@%} {%@@ endif @@%}
@ -168,7 +168,7 @@ if [ -f "{{@@ env['HOME'] @@}}/.local/bin/pipx" ]; then
eval "$(register-python-argcomplete pipx)" eval "$(register-python-argcomplete pipx)"
fi fi
{%@@ if profile == 'VWAGWOY00349' @@%} {%@@ if profile == 'WVDEWOBMC001307' @@%}
# Decide which homebrew installation (x64_86 / arm64) should be used # Decide which homebrew installation (x64_86 / arm64) should be used
if [ "$(sysctl -n sysctl.proc_translated)" = "1" ]; then if [ "$(sysctl -n sysctl.proc_translated)" = "1" ]; then
local brew_path="/usr/local/homebrew/bin" local brew_path="/usr/local/homebrew/bin"
@ -206,7 +206,53 @@ EOF
fi fi
} }
{%@@ if profile == 'VWAGWOY00349' @@%} macnst (){
netstat -Watnlv | grep LISTEN | awk '{"ps -o comm= -p " $9 | getline procname;colred="\033[01;31m";colclr="\033[0m"; print colred "proto: " colclr $1 colred " | addr.port: " colclr $4 colred " | pid: " colclr $9 colred " | name: " colclr procname; }' | column -t -s "|"
}
{%@@ if profile == 'WVDEWOBMC001307' @@%}
function setProxyEnv(){
local HIGHLIGHT='\033[36;1m'
local RESET='\033[0;0m'
local PROXY='127.0.0.1:9000'
local PROXY_CFG_HTTP="${PROXY}"
local PROXY_CFG_HTTPS="${PROXY}"
local NO_PROXY_CFG="127.0.0.1,localhost,vw.vwg"
export NO_PROXY="${NO_PROXY_CFG}"
export no_proxy="${NO_PROXY_CFG}"
export HTTP_PROXY="${PROXY_CFG_HTTP}"
export HTTPS_PROXY="${PROXY_CFG_HTTPS}"
export http_proxy="${PROXY_CFG_HTTP}"
export https_proxy="${PROXY_CFG_HTTPS}"
echo -e "\n✈ exported zscaler proxy: ${HIGHLIGHT}http://${PROXY}${RESET}"
}
function unsetProxyEnv(){
unset NO_PROXY
unset HTTP_PROXY
unset HTTPS_PROXY
unset no_proxy
unset http_proxy
unset https_proxy
echo -e "\n🔄 removed zscaler proxy cofiguration"
}
function setVpnGitRemote(){
local ORIGIN=vpn #e.g.
local HIGHLIGHT='\033[36;1m'
local RESET='\033[0;0m'
local repo="ssh://git@vpn.github.com:443/${$(git config remote.origin.url)#*git@github.com:}"
git remote add ${ORIGIN} "${repo}" 2> /dev/null
echo -e "🔗 git remote (${HIGHLIGHT}${ORIGIN}${RESET}): ${HIGHLIGHT}${repo}${RESET}\n"
}
# Fig post block. Keep at the bottom of this file. # Fig post block. Keep at the bottom of this file.
[[ -f "$HOME/.fig/shell/zshrc.post.zsh" ]] && . "$HOME/.fig/shell/zshrc.post.zsh" [[ -f "$HOME/.fig/shell/zshrc.post.zsh" ]] && . "$HOME/.fig/shell/zshrc.post.zsh"
{%@@ endif @@%} {%@@ endif @@%}