Skip to content

Instantly share code, notes, and snippets.

@DawnBreather
Last active March 12, 2025 14:20
Show Gist options
  • Save DawnBreather/edfbf60f4f3b412151db2f66435b5cf1 to your computer and use it in GitHub Desktop.
Save DawnBreather/edfbf60f4f3b412151db2f66435b5cf1 to your computer and use it in GitHub Desktop.
Installation snippets
command = /opt/homebrew/bin/nu
keybind = global:opt+space=toggle_visibility
copy-on-select = clipboard
background-opacity = 0.9
font-family = JetBrainsMono NF
background-blur = true
macos-option-as-alt = left
keybind = alt+left=unbind
keybind = alt+right=unbind
# https://gist.github.com/tinylucid/9d25c864a75d1d0a90b578dcb36c72f8
# font-size = 16
# font-thicken = true
adjust-underline-position = 40%
adjust-underline-thickness = -60%
cursor-style = block
cursor-style-blink = false
#!/bin/bash
#
# Helix Text Editor Installer
# This script automates the installation of Helix on any x64 Linux machine
# Usage: curl -sSL https://gist.githubusercontent.com/DawnBreather/edfbf60f4f3b412151db2f66435b5cf1/raw/main/helix.install.sh | bash
#
set -e
echo "Installing Helix Text Editor..."
# Get the latest Helix version from GitHub
HELIX_VERSION=$(curl -s "https://api.github.com/repos/helix-editor/helix/releases/latest" | grep -Po '"tag_name": "\K[0-9.]+')
echo "Latest Helix version: $HELIX_VERSION"
# Download the archive
echo "Downloading Helix..."
wget -qO helix.tar.xz "https://github.com/helix-editor/helix/releases/latest/download/helix-$HELIX_VERSION-x86_64-linux.tar.xz"
# Create installation directory
echo "Creating installation directory..."
sudo mkdir -p /opt/helix
# Extract the archive
echo "Extracting Helix..."
sudo tar xf helix.tar.xz --strip-components=1 -C /opt/helix
# Create symbolic link
echo "Creating symbolic link..."
sudo ln -sf /opt/helix/hx /usr/local/bin/hx
# Create runtime directory for syntax highlighting
echo "Setting up runtime files..."
sudo mkdir -p /etc/helix
sudo ln -sf /opt/helix/runtime /etc/helix/runtime
# Clean up
echo "Cleaning up..."
rm -f helix.tar.xz
# Verify installation
echo "Verifying installation..."
HX_VERSION=$(hx --version)
echo "Helix $HX_VERSION has been successfully installed!"
echo "You can now run Helix using the 'hx' command."
#!/bin/bash
set -e
# Usage: curl -sSL https://gist.githubusercontent.com/DawnBreather/edfbf60f4f3b412151db2f66435b5cf1/raw/main/setup-ubuntu-24.04-machine.sh | bash
# Update system
echo "Updating system packages..."
sudo apt update && sudo apt upgrade -y
# Install Ubuntu desktop if not already installed
echo "Installing Ubuntu desktop environment..."
sudo apt install -y ubuntu-desktop
# Install VNC server for remote access
echo "Installing VNC server..."
sudo apt install -y tigervnc-standalone-server tigervnc-xorg-extension
# Install docker
echo "Installing Docker..."
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common gnupg
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io
# Add current user to docker group to run docker without sudo
sudo usermod -aG docker $USER
# Install git
echo "Installing Git..."
sudo apt install -y git
# Install dependencies for python builds
sudo apt install -y build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev python3-openssl
# Install mise (formerly rtx)
echo "Installing mise..."
curl https://mise.run | sh
# Add mise to .bashrc for this session and future ones
echo 'eval "$(~/.local/bin/mise activate bash)"' >> ~/.bashrc
# For immediate use in this script
export PATH="$HOME/.local/bin:$PATH"
eval "$(~/.local/bin/mise activate bash)"
# Use mise to install Python 3.9
echo "Installing Python 3.9 through mise..."
mise install [email protected]
mise use [email protected]
# Install pipx
echo "Installing pipx..."
python3 -m pip install --user pipx
python3 -m pipx ensurepath
export PATH="$HOME/.local/bin:$PATH"
# Install Poetry through pipx
echo "Installing Poetry..."
pipx install poetry
# Install zsh
echo "Installing zsh..."
sudo apt install -y zsh
# Install Oh My Zsh
echo "Installing Oh My Zsh..."
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
# Install useful Oh My Zsh plugins
echo "Installing Oh My Zsh plugins..."
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/agkozak/zsh-z ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-z
# Make zsh the default shell
echo "Setting zsh as default shell..."
sudo chsh -s $(which zsh) $USER
# Generate SSH key
echo "Generating SSH key..."
ssh-keygen -t ed25519 -C "$(whoami)@$(hostname)" -f ~/.ssh/id_ed25519 -N ""
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
# Set up VNC server configuration
echo "Configuring VNC server..."
mkdir -p ~/.vnc
cat > ~/.vnc/xstartup << 'EOF'
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec /usr/bin/gnome-session
EOF
chmod +x ~/.vnc/xstartup
# Set VNC password
echo "Setting up VNC password (you'll be prompted to enter a password)..."
vncpasswd
# Create systemd service for VNC
cat > /tmp/vncserver.service << EOF
[Unit]
Description=Start VNC server at startup
After=syslog.target network.target
[Service]
Type=forking
User=$USER
Group=$USER
WorkingDirectory=/home/$USER
ExecStartPre=-/usr/bin/vncserver -kill :1
ExecStart=/usr/bin/vncserver :1 -geometry 1920x1080 -depth 24
ExecStop=/usr/bin/vncserver -kill :1
[Install]
WantedBy=multi-user.target
EOF
sudo mv /tmp/vncserver.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable vncserver.service
sudo systemctl start vncserver.service
# Install RDP server as alternative to VNC
echo "Installing XRDP server as alternative to VNC..."
sudo apt install -y xrdp
sudo systemctl enable xrdp
sudo systemctl start xrdp
# Final configuration for zsh with all tools
cat >> ~/.zshrc << 'EOF'
# mise configuration
eval "$(~/.local/bin/mise activate zsh)"
# pipx completions
autoload -U bashcompinit
bashcompinit
eval "$(register-python-argcomplete pipx)"
# Add local bin to PATH for pipx installed packages
export PATH="$HOME/.local/bin:$PATH"
# Poetry configuration
export PATH="$HOME/.poetry/bin:$PATH"
# Python configuration
export PYTHONPATH="$PYTHONPATH:$HOME/.local/lib/python3.9/site-packages"
# Load mise shims automatically
mise reshim python
# Oh-my-zsh plugins for better development experience
plugins=(git docker python pip virtualenv zsh-autosuggestions zsh-syntax-highlighting zsh-z)
# Useful aliases
alias python=python3
alias pip=pip3
alias d="docker"
alias dc="docker-compose"
alias g="git"
alias py="python3"
EOF
# Create a quick verification script
cat > ~/verify_setup.sh << 'EOF'
#!/bin/bash
echo "=== Verifying Installation ==="
echo "Docker version:" && docker --version
echo "\nMise version:" && mise --version
echo "\nPython versions available:" && mise ls python
echo "\nCurrent Python version:" && python --version
echo "\nPipx version:" && pipx --version
echo "\nPoetry version:" && poetry --version
echo "\nGit version:" && git --version
echo "\nShell version:" && echo $SHELL
echo "\nOh-my-zsh installation:" && ls -la ~/.oh-my-zsh
echo "\nSSH key:" && ls -la ~/.ssh/id_ed25519
echo "\nRemote access:"
echo "- VNC: $(systemctl is-active vncserver.service)"
echo "- RDP: $(systemctl is-active xrdp)"
echo "\nEverything should be working in your zsh shell now!"
EOF
chmod +x ~/verify_setup.sh
# Display connection information
echo ""
echo "================================================================="
echo "Setup complete! Here's how to connect to your system:"
echo ""
echo "VNC: Connect to $(hostname -I | awk '{print $1}'):5901"
echo "RDP: Connect to $(hostname -I | awk '{print $1}'):3389"
echo ""
echo "Your SSH public key:"
cat ~/.ssh/id_ed25519.pub
echo "================================================================="
echo "To complete the setup, please log out and log back in, or restart your system."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment