Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions 1-BasicSetUp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand Down
81 changes: 70 additions & 11 deletions 2-GenSoftware.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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"
7 changes: 0 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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/
33 changes: 29 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,52 @@ 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.

## 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=<your key from console.groq.com>
```

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
* 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 <webpage-name>`: 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`
* `gpom` : Alias for `git push origin master`. Will push your current directory
* `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 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
* `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.

<br>

Expand Down
12 changes: 2 additions & 10 deletions add_new_user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
25 changes: 24 additions & 1 deletion config_files/bash_aliases
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
6 changes: 6 additions & 0 deletions config_files/byobu_tmux.conf
Original file line number Diff line number Diff line change
@@ -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'
15 changes: 0 additions & 15 deletions config_files/compileCv.sh

This file was deleted.

2 changes: 1 addition & 1 deletion config_files/xbindkeysrc
Original file line number Diff line number Diff line change
Expand Up @@ -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 --
Expand Down
Loading