From d0d69912ba2b7968766c8add1307f6faefcba6c0 Mon Sep 17 00:00:00 2001 From: RS Nikhil Krishna Date: Sun, 4 Oct 2026 09:27:12 -0400 Subject: [PATCH 1/2] Match the setup scripts to the tools this laptop actually uses. Drop Bitwarden, the shared Hugging Face cache, apt VLC, the partner-repo edit, and the OpenCV image build. Install the GitHub and GitLab CLIs, the Session Manager plugin, Snap VLC and Surfshark, Stremio, and the xhisper, dltop, and herdr installs already on the machine. Co-authored-by: Cursor --- 1-BasicSetUp.sh | 17 ++++---- 2-GenSoftware.sh | 81 +++++++++++++++++++++++++++++++----- Dockerfile | 7 ---- README.md | 6 +-- add_new_user.sh | 12 +----- config_files/bash_aliases | 25 ++++++++++- config_files/byobu_tmux.conf | 6 +++ config_files/compileCv.sh | 15 ------- config_files/xbindkeysrc | 2 +- 9 files changed, 113 insertions(+), 58 deletions(-) create mode 100644 config_files/byobu_tmux.conf delete mode 100644 config_files/compileCv.sh diff --git a/1-BasicSetUp.sh b/1-BasicSetUp.sh index 62b6283..5f163b0 100755 --- a/1-BasicSetUp.sh +++ b/1-BasicSetUp.sh @@ -32,13 +32,18 @@ if [[ ! -n $CIINSTALL ]]; then sudo apt-get install ubuntu-restricted-extras -y fi -# Choice for terminal that will be adopted: tmux & zellij -execute sudo apt-get install unzip git byobu magic-wormhole openssh-server python3-pip htop curl expect neofetch ffmpeg software-properties-common git-delta -y +# Terminal multiplexer: byobu (tmux) +execute sudo apt-get install unzip git byobu magic-wormhole openssh-server python3-pip htop curl expect neofetch ffmpeg software-properties-common git-delta git-lfs -y if ! is_ci; then execute sudo apt-get install xrdp -y execute sudo apt-get install xclip xsel -y # this is used for the copying tmux buffer to clipboard buffer fi +# Set up byobu config +rm -rf ~/.byobu && mkdir -p ~/.byobu +cp ./config_files/byobu_tmux.conf ~/.byobu/.tmux.conf +touch ~/.byobu/.screenrc + #Completely uninstall ZSH and Zim along with all z-config files spatialPrint "Removing existing Zsh and Zim installations" @@ -235,14 +240,6 @@ else sudo fc-cache -fv fi -# Build a common shared huggingface cache for all users -if [ ! -d "/opt/huggingface" ]; then - sudo mkdir -p /opt/huggingface - sudo chown -R root:dt_users /opt/huggingface - sudo chmod -R 775 /opt/huggingface - sudo find /opt/huggingface -type d -exec chmod g+s {} + -fi - # Force GDM to use Xorg (X11) instead of Wayland (skip in CI - no display manager) if ! is_ci; then if [[ -f /etc/gdm3/custom.conf ]]; then diff --git a/2-GenSoftware.sh b/2-GenSoftware.sh index ed63c2c..c56d41f 100755 --- a/2-GenSoftware.sh +++ b/2-GenSoftware.sh @@ -97,10 +97,6 @@ fi ### General Software from now on ### -# Enable partner repositories if disabled -sudo sed -i.bak "/^# deb .*partner/ s/^# //" /etc/apt/sources.list -execute sudo apt update - ### CI-Compatible Tools (work in both CI and desktop environments) ### # Google Chrome browser (can run headless in CI) @@ -140,18 +136,40 @@ if ! is_ci; then # Screen recorder execute sudo apt install kazam -y - # Password manager - sudo snap install bitwarden + # Media player and VPN, as snaps + sudo snap install vlc + sudo snap install surfshark - # Media player - execute sudo apt install vlc -y - mkdir -p ~/.cache/vlc + # Stremio from Flathub + execute sudo apt install flatpak -y + sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo + sudo flatpak install -y flathub com.stremio.Stremio # Remote desktop client sudo snap install remmina fi -### AWS CLI +### GitHub and GitLab CLIs +if [ -x "$(command -v gh)" ]; then + echo "GitHub CLI already installed, skipping it" +else + execute sudo apt-get install gh -y +fi + +if [ -x "$(command -v glab)" ]; then + echo "GitLab CLI already installed, skipping it" +else + # Ubuntu's glab package lags the release used day to day. Take the latest .deb. + glab_deb_url="$( + curl -fsSL "https://gitlab.com/api/v4/projects/gitlab-org%2Fcli/releases/permalink/latest" | + python3 -c 'import json,sys; rel=json.load(sys.stdin); print(next(a["direct_asset_url"] for a in rel["assets"]["links"] if a["name"].endswith("_linux_amd64.deb")))' + )" + curl -fsSL "$glab_deb_url" -o /tmp/glab.deb + sudo dpkg -i /tmp/glab.deb + rm -f /tmp/glab.deb +fi + +### AWS CLI and Session Manager plugin if [ -x "$(command -v aws)" ]; then echo "AWS CLI already installed, skipping it" else @@ -161,9 +179,50 @@ else rm -rf ./aws awscliv2.zip fi +if [ -x "$(command -v session-manager-plugin)" ]; then + echo "AWS Session Manager plugin already installed, skipping it" +else + curl -fsSL "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_64bit/session-manager-plugin.deb" -o /tmp/session-manager-plugin.deb + sudo dpkg -i /tmp/session-manager-plugin.deb + rm -f /tmp/session-manager-plugin.deb +fi + +### dltop, herdr, and the xhisper fork +if [ -x "$(command -v dltop)" ]; then + echo "dltop already installed, skipping it" +else + execute sudo apt-get install pipx -y + pipx install dltop + pipx ensurepath +fi + +if [ -x "$(command -v herdr)" ]; then + echo "herdr already installed, skipping it" +else + curl -fsSL https://herdr.dev/install.sh | sh +fi + +if [ -x "$(command -v xhisper)" ]; then + echo "xhisper already installed, skipping it" +else + execute sudo apt-get install -y build-essential pipewire pipewire-utils jq ffmpeg wl-clipboard python3-gi gir1.2-gtk-3.0 bc + xhisper_src="$(mktemp -d)" + # This branch is the fork actually in use. abszar/main does not carry the conda and X11 fixes. + git clone --depth 1 --branch fix/conda-env-and-clipboard-detection https://github.com/rsnk96/xhisper-ubuntu-linux.git "$xhisper_src" + make -C "$xhisper_src" + sudo make -C "$xhisper_src" install + rm -rf "$xhisper_src" + sudo usermod -aG input "$USER" + echo 'KERNEL=="uinput", GROUP="input", MODE="0660"' | sudo tee /etc/udev/rules.d/99-uinput.rules >/dev/null + sudo udevadm control --reload-rules || true + if [[ -e /dev/uinput ]]; then + sudo udevadm trigger /dev/uinput || true + fi +fi + if [[ ! -n $CIINSTALL ]]; then echo "" - echo "Note: If you were added to the docker group, please log out and log back in for changes to take effect." + echo "Note: If you were added to the docker or input group, please log out and log back in for changes to take effect." fi echo "Script finished" diff --git a/Dockerfile b/Dockerfile index 4698a55..6778391 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,6 @@ FROM nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04 # To avoid tzdata configuration during Docker build - https://stackoverflow.com/a/44333806 RUN ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime -# Clone repo in seperate folder WORKDIR /workspace RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y \ @@ -16,9 +15,3 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* && \ dpkg-reconfigure -f noninteractive tzdata - -RUN git clone https://github.com/rsnk96/Ubuntu-Setup-Scripts.git && \ - cd Ubuntu-Setup-Scripts && \ - DEBIAN_FRONTEND=noninteractive ./Build-OpenCV.sh && \ - rm -rf opencv/ && \ - rm -rf opencv_contrib/ diff --git a/README.md b/README.md index 83ef1b5..0dbb101 100755 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ First download/clone this repository Then execute them in the terminal in the sequence of filenames using `./1-BasicSetUp.sh` and `./2-GenSoftware.sh`. * `1-BasicSetUp.sh` - Sets up terminal configuration (Zsh + Zim), download accelerator (aria2), Anaconda Python, shell aliases, Docker, Nvidia drivers (if detected), Neovim with LazyVim, and other essential tools. **Note:** After running this script, you should reboot your PC if you have an Nvidia GPU so that the display driver loads properly. -* `2-GenSoftware.sh` - Installs general purpose software including VS Code, Cursor IDE, browsers (Brave, Chrome), system monitoring tools, screenshot tools, media players, and other utilities. +* `2-GenSoftware.sh` - Installs general purpose software including VS Code, Cursor IDE, browsers (Brave, Chrome), GitHub and GitLab CLIs, the AWS Session Manager plugin, xhisper, dltop, herdr, Snap VLC and Surfshark, Stremio, and other utilities. ## Major Alterations @@ -22,19 +22,19 @@ Then execute them in the terminal in the sequence of filenames using `./1-BasicS * Default shell is changed to Zsh with Zim framework, instead of bash. Why zsh? Because it simply has a much better autocomplete. And why zim? Because it's much faster than Oh My Zsh and Prezto * Docker and Docker Compose will be installed, along with Nvidia Container Toolkit if an Nvidia GPU is detected * Neovim will be installed with LazyVim configuration for a modern editor experience -* Zellij terminal multiplexer will be installed as an alternative to tmux * Display manager will be configured to use X11 (Xorg) instead of Wayland for better compatibility ## Aliases that are added * `maxvol` : Will set your volume to 150% * `download `: Download the webpage and all sub-directories linked to it -* `file_server` : Sets up a server for file sharing in your local network. Whatever is in your current directory will be visible on the ip. It will also print the possible set of IP addresses. To access from another computer, shoot up a browser and simply hit `ip_add:port` +* `file_server` : Serves the current directory on the local network with `python3 -m http.server`, and prints this machine's addresses with `ip -brief addr`. From another computer, open `ip_add:port` * `gpom` : Alias for `git push origin master`. Will push your current directory * `glog` : Shows a rich, annotated git log graph with commits from your current branch, main, and their remote counterparts. Commits show date, relative time, decorations (branches/tags), subject, and author, making it easy to visualize your branch's history in relation to main and remotes. * `jn` : Starts a jupyter notebook in that directory * `jl` : Starts a jupyter lab in that directory * `update`: Runs `sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get autoremove -y` * `aria`: For accelerated download of files using aria2c. Runs the following command: `aria2c --file-allocation=none -c -x 10 -s 10 -d aria2-downloads` +* `intel-turbo off` / `intel-turbo on`: Disable or restore Intel turbo boost. `off` pins every core at its base clock until the next reboot.
diff --git a/add_new_user.sh b/add_new_user.sh index 26ce740..baae4f8 100755 --- a/add_new_user.sh +++ b/add_new_user.sh @@ -28,19 +28,11 @@ sudo cp -r ~/.config/nvim/ "$USER_HOMEDIR/.config" sudo ln -s "$USER_HOMEDIR" /home 2>/dev/null || true -# Set byobu to have scroll mode on by default +# Set up byobu config sudo rm -rf "$USER_HOMEDIR/.byobu" && sudo mkdir -p "$USER_HOMEDIR/.byobu" -echo 'set -g mouse on' | sudo tee -a "$USER_HOMEDIR/.byobu/.tmux.conf" -echo 'set -g default-terminal "tmux-256color"' | sudo tee -a "$USER_HOMEDIR/.byobu/.tmux.conf" +sudo cp ~/.byobu/.tmux.conf "$USER_HOMEDIR/.byobu/.tmux.conf" sudo touch "$USER_HOMEDIR/.byobu/.screenrc" -# Set huggingface cache to shared cache (if it exists) -if [ -d "/opt/huggingface" ]; then - sudo mkdir -p "$USER_HOMEDIR/.cache" - sudo rm -rf "$USER_HOMEDIR/.cache/huggingface" - sudo ln -s /opt/huggingface "$USER_HOMEDIR/.cache/huggingface" -fi - # Change user folder permission, and disable others from reading it sudo chown "$USERNAME:$USERNAME" -R "$USER_HOMEDIR" sudo chmod o-rwX -R "$USER_HOMEDIR" diff --git a/config_files/bash_aliases b/config_files/bash_aliases index 97c79dc..14d4b8f 100644 --- a/config_files/bash_aliases +++ b/config_files/bash_aliases @@ -2,10 +2,33 @@ alias jn="jupyter notebook" alias jl="jupyter lab" alias maxvol="pactl set-sink-volume @DEFAULT_SINK@ 150%" alias download="wget --random-wait -r -p --no-parent -e robots=off -U mozilla" -alias file_server="ifconfig | grep inet && python3 -m http.server" +alias file_server="ip -brief addr && python3 -m http.server" alias gpom="git push origin main" alias glog="git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n''%C(white)%s%C(reset) %C(dim white)- %an%C(reset)' HEAD main origin/main origin/\$(git rev-parse --abbrev-ref HEAD) \$@" alias update="sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y" alias aria="aria2c --file-allocation=none -c -x 10 -s 10" alias cat="batcat -p" alias vi="nvim" + +# `off` writes 1 to no_turbo (boost disabled); `on` writes 0. Cleared on reboot. +intel-turbo() { + local knob=/sys/devices/system/cpu/intel_pstate/no_turbo + if [[ ! -e $knob ]]; then + echo "intel-turbo: Intel P-state turbo control is not available on this machine" >&2 + return 1 + fi + case ${1:-} in + off) + echo 1 | sudo tee "$knob" >/dev/null || return 1 + echo "intel turbo off (base clocks until reboot)" + ;; + on) + echo 0 | sudo tee "$knob" >/dev/null || return 1 + echo "intel turbo on" + ;; + *) + echo "usage: intel-turbo on|off" >&2 + return 1 + ;; + esac +} diff --git a/config_files/byobu_tmux.conf b/config_files/byobu_tmux.conf new file mode 100644 index 0000000..bd65657 --- /dev/null +++ b/config_files/byobu_tmux.conf @@ -0,0 +1,6 @@ +set -g mouse on + +# Copy selection to system clipboard +set -s copy-command 'xclip -selection clipboard' +bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel 'xclip -selection clipboard' +bind-key -T copy-mode Enter send-keys -X copy-pipe-and-cancel 'xclip -selection clipboard' diff --git a/config_files/compileCv.sh b/config_files/compileCv.sh deleted file mode 100644 index 7fb00fd..0000000 --- a/config_files/compileCv.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -set -e: -echo "compiling $1" -if [[ $1 == *.c ]] -then - gcc -ggdb $(pkg-config --cflags opencv) -o $(basename $1 .c) $1 $(pkg-config --libs opencv); -elif [[ $1 == *.cpp ]] -then - g++ -ggdb $(pkg-config --cflags opencv) -o $(basename $1 .cpp) $1 $(pkg-config --libs opencv); -else - echo "Please compile only .c or .cpp files" -fi -echo "Output file => ${1%.*}" -./${1%.*} -rm ${1%.*} diff --git a/config_files/xbindkeysrc b/config_files/xbindkeysrc index cb16eb3..5401b47 100644 --- a/config_files/xbindkeysrc +++ b/config_files/xbindkeysrc @@ -3,7 +3,7 @@ Mod2+Mod4 + e # Screenshot with Flameshot, which will be saved in /tmp. Modified to align with Windows' Snip and Sketch tool shortcut -"flameshot gui -r > /tmp/$(whoami)_$(date +%Y_%m_%d_%H_%M_%S).png" +"flameshot gui -r -p /tmp/$(whoami)_$(date +%Y_%m_%d_%H_%M_%S).png | xclip -selection clipboard -t image/png" Mod2+Mod4+Shift+s # -- Move to Right Workspace -- From 521aa6841fecb2de3bf467367dcae9a70dbd625b Mon Sep 17 00:00:00 2001 From: RS Nikhil Krishna Date: Sun, 4 Oct 2026 09:31:24 -0400 Subject: [PATCH 2/2] Document the manual steps the setup scripts leave unfinished. xhisper needs a Groq key in zshrc and the OSS 120B model in its config, and a desktop shortcut never reads zshrc, so the same export has to live in ~/.env. Co-authored-by: Cursor --- README.md | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0dbb101..197b6a8 100755 --- a/README.md +++ b/README.md @@ -16,6 +16,31 @@ Then execute them in the terminal in the sequence of filenames using `./1-BasicS * `1-BasicSetUp.sh` - Sets up terminal configuration (Zsh + Zim), download accelerator (aria2), Anaconda Python, shell aliases, Docker, Nvidia drivers (if detected), Neovim with LazyVim, and other essential tools. **Note:** After running this script, you should reboot your PC if you have an Nvidia GPU so that the display driver loads properly. * `2-GenSoftware.sh` - Installs general purpose software including VS Code, Cursor IDE, browsers (Brave, Chrome), GitHub and GitLab CLIs, the AWS Session Manager plugin, xhisper, dltop, herdr, Snap VLC and Surfshark, Stremio, and other utilities. +## After the scripts + +Log out and back in once both scripts finish. Reboot instead if an Nvidia driver was installed. That login is what picks up zsh as your shell, X11 instead of Wayland, the `docker` group, and the `input` group xhisper needs for its virtual keyboard. + +* **xhisper.** Transcription and auto-edit call Groq, and neither works until a key is exported from `~/.zshrc`. The auto-edit model to set is OpenAI's open-weight 120B: + + ```sh + export GROQ_API_KEY= + ``` + + Create `~/.config/xhisper/xhisperrc` and point auto-edit at that model. Without this line, auto-edit stays on the built-in default, `llama-3.3-70b-versatile`: + + ``` + llm-model : openai/gpt-oss-120b + ``` + + A GNOME keyboard shortcut does not read `~/.zshrc`. xhisper sources `~/.env` on every run, so put the same `export` there as well, otherwise dictation started from the shortcut has no key. Then add a custom shortcut in Settings → Keyboard → Keyboard Shortcuts → View and Customize Shortcuts → Custom Shortcuts. The command is `/usr/local/bin/xhisper`. Use a `Ctrl+Alt` or `Super` combo. A plain `Alt` letter is swallowed by application menus and never reaches xhisper. Optional words and names go in `~/.config/xhisper/dictionary.txt`, one per line. + +* **GitHub and GitLab.** `gh auth login` and `glab auth login`. The packages are installed, the accounts are not. + +* **AWS.** `aws configure`. The Session Manager plugin is installed beside the CLI and uses those credentials. + +* **dltop.** It runs against `nvidia-smi` immediately. The split between compute engines and NVENC/NVDEC needs DCGM, which a GeForce card does not provide. + +* **intel-turbo.** `intel-turbo off` holds the cores at their base clocks until the next reboot. `intel-turbo on` restores boost. ## Major Alterations * Default python will be changed to Anaconda (Miniconda), with the latest Python 3. Anaconda Python will be installed in `/opt/anaconda3/` so that it is accessible by multiple users @@ -28,7 +53,7 @@ Then execute them in the terminal in the sequence of filenames using `./1-BasicS * `maxvol` : Will set your volume to 150% * `download `: Download the webpage and all sub-directories linked to it * `file_server` : Serves the current directory on the local network with `python3 -m http.server`, and prints this machine's addresses with `ip -brief addr`. From another computer, open `ip_add:port` -* `gpom` : Alias for `git push origin master`. Will push your current directory +* `gpom` : Alias for `git push origin main`. Will push your current directory * `glog` : Shows a rich, annotated git log graph with commits from your current branch, main, and their remote counterparts. Commits show date, relative time, decorations (branches/tags), subject, and author, making it easy to visualize your branch's history in relation to main and remotes. * `jn` : Starts a jupyter notebook in that directory * `jl` : Starts a jupyter lab in that directory