From 7a21b20c062bdd8d73890f4b5116f12773dec103 Mon Sep 17 00:00:00 2001 From: Jeffrey Serio Date: Mon, 19 Aug 2024 15:12:48 -0500 Subject: [PATCH] Add justfile --- justfile | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 justfile diff --git a/justfile b/justfile new file mode 100644 index 0000000..8ecf0b3 --- /dev/null +++ b/justfile @@ -0,0 +1,73 @@ +## Justfile (https://github.com/casey/justfile) +## +## Helps automate various homelab tasks. + +distro := `grep -G "\bID\b" /etc/os-release | awk -F= '{print $2}'` +release := `grep "VERSION_CODENAME" /etc/os-release | awk -F= '{print $2}'` +run_user := env_var("USER") + +caddy: + sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl + curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg + curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list + sudo apt update + sudo apt install caddy + +thelounge: + curl -s https://api.github.com/repos/thelounge/thelounge-deb/releases/latest | grep "browser_download_url.*deb" | cut -d : -f 2,3 | tr -d '"' | wget -qi - + sudo apt install -y ./thelounge*.deb + rm -fv ./thelounge*.deb + +tailscale: + curl -fsSL https://tailscale.com/install.sh | sh + sudo tailscale up + +scihub: + mkdir ~/scihub-torrent-urls + lynx -dump -nonumbers -listonly=on https://libgen.rs/repository_torrent/ | grep "\.torrent" | tee ~/scihub-torrent-urls/urls.txt + cd ~/scihub-torrent-urls && split -l 60 ~/scihub-torrent-urls/urls.txt torrent- + rm -fv ~/scihub-torrent-urls/urls.txt + +docker: + for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt remove $pkg; done + + sudo apt update + sudo apt install -y ca-certificates curl + sudo install -m 0755 -d /etc/apt/keyrings + sudo curl -fsSL https://download.docker.com/linux/{{distro}}/gpg -o /etc/apt/keyrings/docker.asc + sudo chmod a+r /etc/apt/keyrings/docker.asc + + echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/{{distro}} {{release}} 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 docker-buildx-plugin docker-compose docker-compose-plugin + sudo systemctl enable --now docker.service + sudo usermod -aG docker {{run_user}} + +rustup: + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh + +rust-tools: + . "${HOME}/.cargo/env" + cargo install cargo-binstall + for pkg in "arp-scan" "bandwhich" "bat" "diskonaut" "du-dust" "fblog" "fd" "hyperfine" "procs" "ripgrep" "skim"; do \ + cargo-binstall -y "$pkg"; \ + done + +neovim: + sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \ + https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' + + mkdir -p "${HOME}/.config/nvim" + wget https://cdn.hyperreal.coffee/init.vim -O "${HOME}/.config/nvim/init.vim" + +neovim-root: + sudo sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \ + https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' + + sudo mkdir -p /root/.config/nvim + sudo wget https://cdn.hyperreal.coffee/init.vim -O /root/.config/nvim/init.vim + +zshrc: + sudo wget https://cdn.hyperreal.coffee/zshrc -O /etc/zsh/zshrc + touch "${HOME}/.zshrc" + sudo touch /root/.zshrc