Last active
August 2, 2025 07:25
-
-
Save HeshamMeneisi/fcab19cbeb0a1b5c524fd67a7da2b079 to your computer and use it in GitHub Desktop.
Shell Quick Setup
This file contains hidden or 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
# path: ~/.shell_aliases | |
# variables | |
export WINDOWS_USER=$(cmd.exe /c "echo %USERPROFILE%" | tr -d '\r' | awk -F'\\\\' '{print $NF}') | |
export WINDOWS_HOME="/mnt/c/Users/$WINDOWS_USER" | |
export SHELL_NAME=$(basename "$SHELL") | |
export SHELL_CONFIG=$(realpath ~/.${SHELL_NAME}rc) | |
export REPOS=$(realpath ~/repositories) | |
# terminal | |
alias srs='SHELL_PERFORMANCE_MODE=0 exec $SHELL' | |
alias srsp='SHELL_PERFORMANCE_MODE=1 exec $SHELL' | |
alias edit='code' | |
alias aconfig='edit ~/.shell_aliases' | |
alias sconfig='edit $SHELL_CONFIG' | |
# git | |
alias gcl='gcl_func' | |
alias gs='git status' | |
alias ghb='gh browse' | |
alias ghp='gh pr view --web' | |
# kubernetes | |
alias k='kubectl' | |
alias kn='kubens' | |
alias kx='kubectx' | |
# terraform | |
alias tf='terraform' | |
alias tff='tf fmt' | |
alias tfv='tff & tf validate' | |
alias tfa='tf apply' | |
alias tfp='tf plan' | |
alias tfi='tf init' | |
alias tfo='tf output' | |
alias tfs='tf show' | |
alias tfw='tf workspace' | |
alias tfws='tf select' | |
alias tfww='tfww_func' | |
# functions | |
# windows | |
function wopen() { | |
linux_path="$1" | |
explorer.exe $(wslpath -w "$linux_path") | |
} | |
# git | |
function gcl_func() { | |
repo_id="$1" | |
target_path="$REPOS/$repo_id" | |
mkdir -p "$target_path" | |
shift | |
git clone "$@" "https://github.com/$repo_id.git" "$target_path" | |
} | |
# terraform | |
tfww_func() { | |
local org=$(jq -r '.backend.config.organization' .terraform/terraform.tfstate 2>/dev/null) | |
local ws=$(terraform workspace show 2>/dev/null) | |
if [[ -z "$org" || -z "$ws" ]]; then | |
echo "Organization or workspace not found" | |
return 1 | |
fi | |
local url="https://app.terraform.io/app/${org}/workspaces/${ws}" | |
echo "Opening: $url" | |
xdg-open "$url" 2>/dev/null || open "$url" | |
} |
This file contains hidden or 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
set -xeo | |
# apt packages | |
sudo apt update | |
sudo apt install make zoxide xdg-utils wslu -y | |
# snap packages | |
sudo snap install gh | |
# install snap --classic packages | |
snap_classic_packages=("terraform" "helm" "kubectl" "kubectx") | |
for pkg in "${snap_classic_packages[@]}"; do echo "Installing $pkg with --classic..."; sudo snap install $pkg --classic; done | |
# download & source aliases | |
SHEL_ALIASES_URL="https://gist.githubusercontent.com/HeshamMeneisi/fcab19cbeb0a1b5c524fd67a7da2b079/raw/.shell_aliases" | |
curl -L $SHEL_ALIASES_URL -o ~/.shell_aliases | |
source ~/.shell_aliases | |
# install oh-my-shell | |
$SHELL -c "$(curl -fsSL https://raw.githubusercontent.com/ohmy${SHELL_NAME}/oh-my-${SHELL_NAME}/master/tools/install.sh)" | |
# configure aliases and j in shell config | |
echo ' | |
source ~/.shell_aliases | |
eval "$(zoxide init --cmd=j $SHELL_NAME)" | |
' >> "$SHELL_CONFIG" | |
source "$SHELL_CONFIG" | |
# ble.sh (autosuggestions) | |
gcl akinomyoga/ble.sh --recursive | |
cd $REPOS/akinomyoga/ble.sh | |
make install | |
echo " | |
if [[ SHELL_PERFORMANCE_MODE -ne 1 ]]; then | |
source ~/.local/share/blesh/ble.sh | |
fi | |
" >> "$SHELL_CONFIG" | |
srs |
This file contains hidden or 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
# VSCode | |
# install: https://code.visualstudio.com/ | |
# install: https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack | |
# WSL | |
wsl --list --online | |
wsl --install Ubuntu | |
wsl | |
# install aliases and useful tools | |
curl -s https://gist.githubusercontent.com/HeshamMeneisi/fcab19cbeb0a1b5c524fd67a7da2b079/raw/auto_install_linux.sh | $SHELL_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment