Skip to content

Instantly share code, notes, and snippets.

@HeshamMeneisi
Last active May 28, 2025 12:47
Show Gist options
  • Save HeshamMeneisi/fcab19cbeb0a1b5c524fd67a7da2b079 to your computer and use it in GitHub Desktop.
Save HeshamMeneisi/fcab19cbeb0a1b5c524fd67a7da2b079 to your computer and use it in GitHub Desktop.
WSL quick setup
# 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'
# kubernetes
alias k='kubectl'
alias kn='kubens'
alias kx='kubectx'
# terraform
alias tf='terraform'
alias tfa='terraform apply'
alias tfp='terraform plan'
alias tff='terraform fmt'
alias tfi='terraform init'
alias tfo='terraform output'
alias tfs='terraform show'
alias tfw='terraform workspace'
alias tfwc='terraform workspace select'
# 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"
}
# 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
# packages
sudo apt update
sudo apt install make zoxide -y
sudo snap install terraform helm kubectx --classic
# shell
# download: .shell_aliases > ~/.shell_aliases
$SHELL -c "$(curl -fsSL https://raw.githubusercontent.com/ohmy${SHELL_NAME}/oh-my-${SHELL_NAME}/master/tools/install.sh)"
curl -sSfL https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | sh
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment