Created
January 21, 2025 10:06
-
-
Save CodeBrauer/b7505bdf2001ca02ab08cddf9895b693 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ================================== | |
# Oh My Zsh Configuration | |
# ================================== | |
export ZSH="$HOME/.oh-my-zsh" | |
ZSH_THEME="robbyrussell" | |
# Uncomment below to use random themes | |
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) | |
# Uncomment for case-sensitive or hyphen-insensitive completion | |
# CASE_SENSITIVE="true" | |
# HYPHEN_INSENSITIVE="true" | |
# Configure auto-update | |
# zstyle ':omz:update' mode disabled # Disable updates | |
# zstyle ':omz:update' mode auto # Update automatically | |
# zstyle ':omz:update' frequency 13 # Auto-update period in days | |
# Source Oh My Zsh | |
source $ZSH/oh-my-zsh.sh | |
# ================================== | |
# Prompt and Display Configuration | |
# ================================== | |
# Define the left side prompt | |
PROMPT='%{$fg[yellow]%}[%*] '$PROMPT | |
# Uncomment for right-side prompt | |
# RPROMPT="[%D %*]" | |
# Enable completion waiting dots | |
export COMPLETION_WAITING_DOTS="true" | |
# ================================== | |
# Plugins | |
# ================================== | |
plugins=( | |
git | |
omz-git | |
docker | |
docker-compose | |
gcloud | |
helm | |
kubectl | |
lando | |
nvm | |
# Uncomment `kube-ps1` if needed | |
# kube-ps1 | |
) | |
# ================================== | |
# User Environment Variables | |
# ================================== | |
export MANPATH="/usr/local/man:$MANPATH" | |
export LANG=en_US.UTF-8 | |
export ARCHFLAGS="-arch arm64" | |
# Default editor | |
export EDITOR=nano | |
# Cloud-related configuration | |
export USE_GKE_GCLOUD_AUTH_PLUGIN=True | |
# Fix for Ansible bug | |
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES | |
# AWS configuration | |
export AWS_SESSION_TOKEN_TTL= | |
export AWS_CHAINED_SESSION_TOKEN_TTL= | |
export AWS_MFA_SERIAL= | |
# ================================== | |
# PATH Configuration | |
# ================================== | |
export PATH="/usr/local/bin:$PATH" | |
export PATH="/opt/homebrew/bin:$PATH" | |
export PATH="/opt/homebrew/sbin:$PATH" | |
export PATH=$HOME/bin:/usr/local/bin:$PATH | |
export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH" | |
export PATH="/opt/homebrew/opt/[email protected]/sbin:$PATH" | |
export PATH=~/.composer/vendor/bin:$PATH | |
export PATH="$HOME/.symfony/bin:$PATH" | |
export PATH="$HOME/bin:$PATH" | |
export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH" | |
export PATH="/opt/homebrew/opt/[email protected]/sbin:$PATH" | |
export PATH="/opt/homebrew/opt/whois/bin:$PATH" | |
# NVM Configuration | |
export NVM_DIR="$HOME/.nvm" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" | |
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" | |
# ================================== | |
# Aliases | |
# ================================== | |
# Directory navigation | |
alias ll='gls -hltoa --color=auto --group-directories-first --time-style=long-iso' | |
alias ..='cd ../' | |
alias ..2='cd ../../' | |
alias ..3='cd ../../../' | |
alias ..4='cd ../../../../' | |
# Simple utilities | |
alias header='curl -I' | |
alias myshell='ps -p $$' | |
alias myip='curl ipinfo.io/ip' | |
alias mylocalip="ifconfig | grep 'inet ' | grep -Fv 127.0.0.1 | awk '{print $2}'" | |
alias pass='openssl rand -base64 20' | |
# PhpStorm | |
# alias phpstorm=open -a PhpStorm | |
# UUID generation | |
alias uuid_lower='uuidgen | python3 -c "print(open(0).read().lower())" | awk NF' | |
alias uuid_c='uuidgen | python3 -c "print(open(0).read().lower())" | tr -d "\n" | pbcopy' | |
# Docker and Kubernetes | |
alias dops="docker ps" | |
alias dopa="docker ps -a" | |
alias k9s-ro='k9s --readonly' | |
# File cleanup | |
alias killDS='find . -name .DS_Store -type f -delete' | |
alias killThumbs='find . -name Thumbs.db -type f -delete' | |
# DNS | |
alias flushdns='sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder' | |
# Dev environment | |
alias dev="cd ~/dev && ll" | |
# ================================== | |
# Functions | |
# ================================== | |
docker-log-clear(){ | |
echo "rm /var/lib/docker/containers/*/*.log" | nc -U -w 0 ~/Library/Containers/com.docker.docker/Data/debug-shell.sock | |
} | |
fix_cs () { | |
git ls-files -m --others --exclude-standard | xargs docker compose exec -T php-fpm bin/php-cs-fixer fix --verbose --config=.php-cs-fixer.dist.php | |
} | |
fix_prettier () { | |
git ls-files -m --others --exclude-standard | xargs npx prettier --write | |
} | |
check_port_forwards() { | |
local kubectl_process=$(pgrep -f "kubectl port-forward") | |
local tunneler_process=$(pgrep -f "tunneler") | |
if [[ -n "$kubectl_process" ]] || [[ -n "$tunneler_process" ]]; then | |
echo -e "\033[33mWarning: The following processes are running:\033[0m" | |
if [[ -n "$kubectl_process" ]]; then | |
echo "kubectl port-forward is running with PID(s): $kubectl_process" | |
fi | |
if [[ -n "$tunneler_process" ]]; then | |
echo "tunneler is running with PID(s): $tunneler_process" | |
fi | |
else | |
echo -e "\033[32mOK - no k8s/tunneler port forwards found\033[0m" | |
fi | |
} | |
function git_create_branch() { | |
local branchname=$1 | |
if [ -z "$branchname" ]; then | |
read -p "Enter branch name: " branchname | |
fi | |
git checkout master && git pull && git branch "$branchname" && git checkout "$branchname" | |
} | |
alias mkbr=git_create_branch | |
# ================================== | |
# Sources and Configurations | |
# ================================== | |
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh" | |
source <(kubectl completion zsh) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment