Skip to content

Instantly share code, notes, and snippets.

@secondfry
Last active August 6, 2025 20:43
Show Gist options
  • Select an option

  • Save secondfry/f32f7d24f2cf2714542a6102bb43492c to your computer and use it in GitHub Desktop.

Select an option

Save secondfry/f32f7d24f2cf2714542a6102bb43492c to your computer and use it in GitHub Desktop.
#!/usr/bin/bash
# Color codes
BLUE='\033[0;34m'
MAGENTA='\033[0;35m'
CYAN='\033[0;36m'
YELLOW='\033[0;33m'
RED='\033[0;31m'
GRAY='\033[0;90m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
# Function to color stderr
color_stderr() {
"$@" 2> >(while IFS= read -r line; do printf "${GRAY}%s${NC}\n" "$line" >&2; done)
}
# Core function to run a section with commands
run_section() {
local section_name="$1"
shift
printf "${BLUE}==> %s${NC}\n" "$section_name"
while [[ $# -gt 0 ]]; do
local description="$1"
local command="$2"
shift 2
printf "${YELLOW} • %s${NC}\n" "$description"
color_stderr eval "$command"
done
}
run_section "System Updates" \
"Updating package lists" "sudo apt update" \
"Upgrading packages" "sudo apt upgrade -y"
run_section "Package Installation" \
"Installing zsh ripgrep htop nano unzip" "sudo apt install -y zsh ripgrep htop nano unzip"
run_section "ZSH Plugin Installation" \
"Cloning zsh-autosuggestions" "git clone https://github.com/zsh-users/zsh-autosuggestions \$HOME/.zsh/zsh-autosuggestions" \
"Cloning zsh-history-substring-search" "git clone https://github.com/zsh-users/zsh-history-substring-search.git \$HOME/.zsh/zsh-history-substring-search" \
"Cloning zsh-better-npm-completion" "git clone https://github.com/lukechilds/zsh-better-npm-completion.git \$HOME/.zsh/zsh-better-npm-completion"
run_section "System utilities" \
"FNM: installing" "curl -fsSL https://fnm.vercel.app/install | zsh -s -- --skip-shell" \
"Bun: installing" "curl -fsSL https://bun.com/install | bash" \
"fzf: cloning" "git clone --depth 1 https://github.com/junegunn/fzf.git \$HOME/.fzf" \
"fzf: installing" "\$HOME/.fzf/install --key-bindings --completion --no-update-rc"
run_section "ZSH Configuration" \
"Downloading .zshrc from grml.org" "curl -fsSLo \$HOME/.zshrc https://grml.org/console/zshrc" \
"Downloading .zshrc.local" "curl -fsSLo \$HOME/.zshrc.local https://gist.githubusercontent.com/secondfry/79b702d4530966f337bc2fcfdccd63c2/raw/e55de2fa40acdac4b41ae48f01537a9084f4108c/.zshrc.local%2520not.zsh"
run_section "Shell Configuration" \
"Changing default shell to zsh for \$(whoami)" "[[ -x \$(which zsh 2>/dev/null) ]] && sudo chsh -s \$(which zsh) \$(whoami) || echo 'zsh not found, skipping shell change'"
printf "\n${GREEN}✓ Setup complete!${NC}\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment