Refactor setup workflow
This commit is contained in:
94
Zsh/.zsh_aliases
Normal file
94
Zsh/.zsh_aliases
Normal file
@@ -0,0 +1,94 @@
|
||||
# .zsh_aliases
|
||||
|
||||
alias mpset="make -C ~/Config/Dot-Zsh"
|
||||
|
||||
# Aliases
|
||||
alias c="clear"
|
||||
|
||||
alias vi="nvim"
|
||||
alias vim="nvim"
|
||||
|
||||
alias ls="eza --icons"
|
||||
alias la="eza --icons -a"
|
||||
alias ll="eza --icons -la"
|
||||
|
||||
alias grep="grep --color=auto"
|
||||
|
||||
alias src="source ~/.zshrc && echo '🔄 Reloaded .zshrc'"
|
||||
|
||||
alias cat="bat"
|
||||
alias fd="fd"
|
||||
|
||||
alias tree="eza --icons -T --git-ignore"
|
||||
|
||||
# Navigation
|
||||
alias ..="cd .."
|
||||
alias ...="cd ../.."
|
||||
alias ....="cd ../../.."
|
||||
alias ~="cd ~"
|
||||
alias back="cd -"
|
||||
|
||||
# File Management
|
||||
alias rm="rm -i"
|
||||
alias cp="cp -i"
|
||||
alias mv="mv -i"
|
||||
alias mkcd='foo() { mkdir -p "$1"; cd "$1"; }; foo'
|
||||
|
||||
# Storage
|
||||
alias dfh="df -h" # Disk Free in Human Readable format
|
||||
alias duh="du -h --max-depth=1" # Disk Usage in Human Readable format
|
||||
|
||||
# System
|
||||
alias top="btop"
|
||||
alias cpu="lscpu"
|
||||
|
||||
# Network
|
||||
alias ip="ip -c" # IP command with colorized output
|
||||
alias ports="ss -tulanp" # List all listening ports
|
||||
alias myip="curl ifconfig.me" # Get public IP address
|
||||
alias pingg="ping google.com" # Network Testing
|
||||
|
||||
# WSL Specific
|
||||
if grep -qEi "(Microsoft|WSL)" /proc/version &> /dev/null; then
|
||||
# 1. Windows Explorer
|
||||
alias winExp="/mnt/c/Windows/explorer.exe"
|
||||
alias open="/mnt/c/Windows/explorer.exe" # Mac-style 'open' command
|
||||
|
||||
# 2. VS Code (Dynamic Alias)
|
||||
if [ -f "/mnt/c/Windows/System32/cmd.exe" ]; then
|
||||
_WIN_USER=$(/mnt/c/Windows/System32/cmd.exe /c 'echo %USERNAME%' 2>/dev/null | tr -d '\r')
|
||||
|
||||
# Only proceed if we actually got a username back
|
||||
if [ -n "$_WIN_USER" ]; then
|
||||
USER_CODE="/mnt/c/Users/$_WIN_USER/AppData/Local/Programs/Microsoft VS Code/bin/code"
|
||||
SYS_CODE="/mnt/c/Program Files/Microsoft VS Code/bin/code"
|
||||
|
||||
if [ -f "$USER_CODE" ]; then
|
||||
# We use single quotes for the alias definition to handle the spaces safely
|
||||
alias code="'$USER_CODE'"
|
||||
elif [ -f "$SYS_CODE" ]; then
|
||||
alias code="'$SYS_CODE'"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
alias local-stt="python ~/Application/STT/stt.py"
|
||||
|
||||
# Vault
|
||||
alias vl="vault login -method=userpass username=mangopig"
|
||||
alias vs="vault status"
|
||||
alias vkv="vault kv get"
|
||||
alias vkvl="vault kv list"
|
||||
|
||||
# Proxy
|
||||
proxy_on() {
|
||||
export ALL_PROXY=socks5h://192.168.1.26:1080
|
||||
export HTTP_PROXY=socks5h://192.168.1.26:1080
|
||||
export HTTPS_PROXY=socks5h://192.168.1.26:1080
|
||||
echo "Proxy ON (Mullvad NL)"
|
||||
}
|
||||
proxy_off() {
|
||||
unset ALL_PROXY HTTP_PROXY HTTPS_PROXY
|
||||
echo "Proxy OFF (direct)"
|
||||
}
|
||||
26
Zsh/.zsh_secrets.example
Normal file
26
Zsh/.zsh_secrets.example
Normal file
@@ -0,0 +1,26 @@
|
||||
# ~/.zsh_secrets
|
||||
#
|
||||
# Copy this file to ~/.zsh_secrets and fill in real values locally.
|
||||
# Do not commit real secrets.
|
||||
|
||||
# Core local values
|
||||
export AZURE_URL=""
|
||||
export VM_SUDO_PASS=""
|
||||
|
||||
# API keys and tokens
|
||||
export TAOBAO_API_KEY=""
|
||||
export AZURE_OPENAI_API_KEY=""
|
||||
export OUTLINE_MOKU_TOKEN=""
|
||||
export DOKPLOY_API_KEY=""
|
||||
export N8N_AUTH=""
|
||||
export CONTEXT7_API_KEY=""
|
||||
export GITEA_ACCESS_TOKEN=""
|
||||
export NETDATA_TOKEN=""
|
||||
export OBSIDIAN_API_KEY=""
|
||||
export GITHUB_TOKEN=""
|
||||
export OPEN_ROUTER_API_KEY=""
|
||||
|
||||
# Optional overrides
|
||||
# export VAULT_ADDR="http://192.168.30.53:8200"
|
||||
# export OPENCHAMBER_HOST="0.0.0.0"
|
||||
# export PLANNOTATOR_PORT="9999"
|
||||
25
Zsh/.zshenv
Normal file
25
Zsh/.zshenv
Normal file
@@ -0,0 +1,25 @@
|
||||
# ENV File
|
||||
|
||||
# Load machine-local secrets before defining any derived environment variables.
|
||||
[ -f "$HOME/.zsh_secrets" ] && source "$HOME/.zsh_secrets"
|
||||
|
||||
export GOGC=500
|
||||
export R_ROOT="$HOME/.programming/r"
|
||||
export R_LIBS_USER="$R_ROOT/library"
|
||||
|
||||
# CodeGraphContext defaults
|
||||
export CGC_RUNTIME_DB_TYPE=kuzudb
|
||||
export KUZUDB_PATH="$HOME/.codegraphcontext/kuzudb"
|
||||
|
||||
export PATH="$HOME/.opencode/bin:$PATH"
|
||||
export OPENCHAMBER_HOST="${OPENCHAMBER_HOST:-0.0.0.0}"
|
||||
export VAULT_ADDR="${VAULT_ADDR:-http://192.168.30.53:8200}"
|
||||
export PLANNOTATOR_PORT="${PLANNOTATOR_PORT:-9999}"
|
||||
|
||||
# Derived environment variables that may depend on machine-local secrets.
|
||||
[ -n "${AZURE_URL:-}" ] && export AZURE_COGNITIVE_SERVICES_RESOURCE_NAME="$AZURE_URL"
|
||||
[ -n "${AZURE_URL:-}" ] && export AZURE_RESOURCE_NAME="$AZURE_URL"
|
||||
[ -n "${VM_SUDO_PASS:-}" ] && export OPENCHAMBER_UI_PASSWORD="$VM_SUDO_PASS"
|
||||
[ -n "${AZURE_OPENAI_API_KEY:-}" ] && export FOUNDRY_ANTHROPIC_API_KEY="$AZURE_OPENAI_API_KEY"
|
||||
[ -n "${AZURE_OPENAI_API_KEY:-}" ] && export CHROMA_OPENAI_API_KEY="$AZURE_OPENAI_API_KEY"
|
||||
[ -n "${OUTLINE_MOKU_TOKEN:-}" ] && export OUTLINE_MOKU_AUTHORIZATION="Bearer $OUTLINE_MOKU_TOKEN"
|
||||
80
Zsh/.zshrc
Normal file
80
Zsh/.zshrc
Normal file
@@ -0,0 +1,80 @@
|
||||
# .zshrc
|
||||
|
||||
# Zsh Configuration
|
||||
export ZSH="$HOME/.oh-my-zsh"
|
||||
|
||||
# Programming Languages Root
|
||||
export PROG_DIR="$HOME/.programming"
|
||||
|
||||
PROMPT="%B%~%b :: "
|
||||
RPROMPT="%n@%m"
|
||||
|
||||
# Plugins
|
||||
plugins=(git zsh-syntax-highlighting zsh-autosuggestions sudo rclone rust nvm golang conda pyenv)
|
||||
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
|
||||
# Go and GVM (Black Box)
|
||||
export GOPATH="$PROG_DIR/go"
|
||||
export GVM_ROOT="$GOPATH"
|
||||
[[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm"
|
||||
|
||||
# Node and NVM (Lazy Load)
|
||||
export NVM_DIR="$PROG_DIR/node"
|
||||
|
||||
nvm_load() {
|
||||
echo "💤 Waking up NVM..."
|
||||
unset -f nvm node npm npx
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
|
||||
"$@"
|
||||
}
|
||||
|
||||
nvm() { nvm_load "nvm" "$@"; }
|
||||
node() { nvm_load "node" "$@"; }
|
||||
npm() { nvm_load "npm" "$@"; }
|
||||
npx() { nvm_load "npx" "$@"; }
|
||||
|
||||
# Rust and Cargo
|
||||
export RUSTUP_HOME="$PROG_DIR/rust/multirust"
|
||||
export CARGO_HOME="$PROG_DIR/rust/cargo"
|
||||
|
||||
# Python (Pyenv + Miniconda)
|
||||
export PYENV_ROOT="$PROG_DIR/python/pyenv"
|
||||
export PATH="$PYENV_ROOT/bin:$PATH"
|
||||
|
||||
if command -v pyenv 1>/dev/null 2>&1; then
|
||||
eval "$(pyenv init -)"
|
||||
fi
|
||||
|
||||
if command -v conda >/dev/null 2>&1; then
|
||||
CONDA_BASE=$(conda info --base)
|
||||
[ -f "$CONDA_BASE/etc/profile.d/conda.sh" ] && source "$CONDA_BASE/etc/profile.d/conda.sh"
|
||||
fi
|
||||
|
||||
# R and Rig
|
||||
export RIG_HOME="$PROG_DIR/r"
|
||||
if [ -d "$RIG_HOME/bin" ]; then
|
||||
export PATH="$RIG_HOME/bin:$PATH"
|
||||
fi
|
||||
|
||||
# Zoxide
|
||||
if command -v zoxide >/dev/null 2>&1; then
|
||||
eval "$(zoxide init --cmd cd zsh)"
|
||||
fi
|
||||
|
||||
# Source Aliases & Secrets
|
||||
[ -f ~/.zsh_aliases ] && source ~/.zsh_aliases
|
||||
[ -f ~/.zsh_secrets ] && source ~/.zsh_secrets
|
||||
|
||||
# Add to PATH
|
||||
export PATH="$HOME/.local/bin:$CARGO_HOME/bin:$GOPATH/bin:$PATH"
|
||||
|
||||
# opencode
|
||||
if command -v openchamber >/dev/null 2>&1 && ! pgrep -f "openchamber.*7891" > /dev/null; then
|
||||
openchamber --port 7891 >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
# direnv
|
||||
if command -v direnv >/dev/null 2>&1; then
|
||||
eval "$(direnv hook zsh)"
|
||||
fi
|
||||
Reference in New Issue
Block a user