From 55294be378e6abb2eb96b1efc7aad85de383d015 Mon Sep 17 00:00:00 2001 From: Wynd Date: Sat, 1 Jun 2024 23:06:02 +0300 Subject: [PATCH] Added install script, some gif making scripts, switched to eza and some nvim config changes --- .config/btop/btop.conf | 25 +- .config/nvim/after/ftplugin/markdown.lua | 1 - .config/nvim/lazy-lock.json | 2 +- .../nvim/lua/nvwynd/plugins/formatting.lua | 1 + .config/nvim/lua/nvwynd/plugins/lsp.lua | 5 + .config/nvim/lua/nvwynd/plugins/util.lua | 6 + .zshrc | 4 +- README.md | 12 +- install.sh | 246 ++++++++++++++++++ scripts/best-gif.sh | 48 ++++ scripts/make-gif.sh | 47 ++++ 11 files changed, 387 insertions(+), 10 deletions(-) create mode 100755 install.sh create mode 100755 scripts/best-gif.sh create mode 100755 scripts/make-gif.sh diff --git a/.config/btop/btop.conf b/.config/btop/btop.conf index f7b4470..3e59f52 100644 --- a/.config/btop/btop.conf +++ b/.config/btop/btop.conf @@ -1,4 +1,4 @@ -#? Config file for btop v. 1.2.7 +#? Config file for btop v. 1.3.2 #* Name of a btop++/bpytop/bashtop formatted ".theme" file, "Default" and "TTY" for builtin themes. #* Themes should be placed in "../share/btop/themes" relative to binary or "$HOME/.config/btop/themes" @@ -16,7 +16,7 @@ force_tty = False #* Define presets for the layout of the boxes. Preset 0 is always all boxes shown with default settings. Max 9 presets. #* Format: "box_name:P:G,box_name:P:G" P=(0 or 1) for alternate positions, G=graph symbol to use for box. -#* Use withespace " " as separator between different presets. +#* Use whitespace " " as separator between different presets. #* Example: "cpu:0:default,mem:0:tty,proc:1:default cpu:0:braille,proc:0:tty" presets = "cpu:1:default,proc:0:default cpu:0:default,mem:0:default,net:0:default net:0:default" @@ -46,8 +46,8 @@ graph_symbol_net = "default" # Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty". graph_symbol_proc = "default" -#* Manually set which boxes to show. Available values are "cpu mem net proc", separate values with whitespace. -shown_boxes = "mem net proc cpu" +#* Manually set which boxes to show. Available values are "cpu mem net proc" and "gpu0" through "gpu5", separate values with whitespace. +shown_boxes = "cpu mem proc net" #* Update time in milliseconds, recommended 2000 ms or above for better sample times for graphs. update_ms = 1000 @@ -74,12 +74,21 @@ proc_per_core = False #* Show process memory as bytes instead of percent. proc_mem_bytes = True +#* Show cpu graph for each process. +proc_cpu_graphs = True + #* Use /proc/[pid]/smaps for memory information in the process info box (very slow but more accurate) proc_info_smaps = False #* Show proc box on left side of screen instead of right. proc_left = False +#* (Linux) Filter processes tied to the Linux kernel(similar behavior to htop). +proc_filter_kernel = False + +#* In tree-view, always accumulate child process resources in the parent process. +proc_aggregate = False + #* Sets the CPU stat shown in upper half of the CPU graph, "total" is always available. #* Select from a list of detected attributes from the options menu. cpu_graph_upper = "total" @@ -162,6 +171,9 @@ only_physical = True #* Read disks list from /etc/fstab. This also disables only_physical. use_fstab = True +#* Setting this to True will hide all datasets, and only show ZFS pools. (IO stats will be calculated per-pool) +zfs_hide_datasets = False + #* Set to true to show available disk space for privileged users. disk_free_priv = False @@ -198,6 +210,9 @@ show_battery = True #* Which battery to use if multiple are present. "Auto" for auto detection. selected_battery = "Auto" +#* Show power stats of battery next to charge indicator. +show_battery_watts = True + #* Set loglevel for "~/.config/btop/btop.log" levels are: "ERROR" "WARNING" "INFO" "DEBUG". #* The level set includes all lower levels, i.e. "DEBUG" will show all logging info. -log_level = "WARNING" \ No newline at end of file +log_level = "WARNING" diff --git a/.config/nvim/after/ftplugin/markdown.lua b/.config/nvim/after/ftplugin/markdown.lua index d02a662..cc0160c 100644 --- a/.config/nvim/after/ftplugin/markdown.lua +++ b/.config/nvim/after/ftplugin/markdown.lua @@ -3,6 +3,5 @@ local winid = vim.api.nvim_get_current_win() local wo = vim.wo[winid][0] wo.spell = true -wo.wrap = true vim.cmd.highlight({ "SpellBad", "gui=undercurl", "guifg=#DA6464" }) diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 3ff0a0e..0f48380 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -20,6 +20,7 @@ "nvim-cmp": { "branch": "main", "commit": "8f3c541407e691af6163e2447f3af1bd6e17f9a3" }, "nvim-lspconfig": { "branch": "master", "commit": "7133e85c3df14a387da8942c094c7edddcdef309" }, "nvim-notify": { "branch": "master", "commit": "5371f4bfc1f6d3adf4fe9d62cd3a9d44356bfd15" }, + "nvim-surround": { "branch": "main", "commit": "79aaa42da1f698ed31bcbe7f83081f69dca7ba17" }, "nvim-treesitter": { "branch": "master", "commit": "0883ff05655117a3fc79ab295a640c4984cfd415" }, "nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" }, "nvim-web-devicons": { "branch": "master", "commit": "beb6367ab8496c9e43f22e0252735fdadae1872d" }, @@ -28,7 +29,6 @@ "todo-comments.nvim": { "branch": "main", "commit": "a7e39ae9e74f2c8c6dc4eea6d40c3971ae84752d" }, "trouble.nvim": { "branch": "main", "commit": "b9cf677f20bb2faa2dacfa870b084e568dca9572" }, "twilight.nvim": { "branch": "main", "commit": "8b7b50c0cb2dc781b2f4262a5ddd57571556d1e4" }, - "urlview.nvim": { "branch": "main", "commit": "9206224f6cfe62b35d5ae5610e225c6d0a6436d3" }, "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }, "zen-mode.nvim": { "branch": "main", "commit": "78557d972b4bfbb7488e17b5703d25164ae64e6a" } } \ No newline at end of file diff --git a/.config/nvim/lua/nvwynd/plugins/formatting.lua b/.config/nvim/lua/nvwynd/plugins/formatting.lua index 8ffcbe5..4c14b79 100644 --- a/.config/nvim/lua/nvwynd/plugins/formatting.lua +++ b/.config/nvim/lua/nvwynd/plugins/formatting.lua @@ -29,6 +29,7 @@ return { format_on_save = { timeout_ms = 500, lsp_fallback = true, + quiet = true, }, }, init = function() diff --git a/.config/nvim/lua/nvwynd/plugins/lsp.lua b/.config/nvim/lua/nvwynd/plugins/lsp.lua index 2101847..83f3086 100644 --- a/.config/nvim/lua/nvwynd/plugins/lsp.lua +++ b/.config/nvim/lua/nvwynd/plugins/lsp.lua @@ -75,6 +75,11 @@ return { capabilities = capabilities, }) + -- Bash + lspconfig.bashls.setup({ + capabilities = capabilities, + }) + -- HTML lspconfig.html.setup({ capabilities = capabilities, diff --git a/.config/nvim/lua/nvwynd/plugins/util.lua b/.config/nvim/lua/nvwynd/plugins/util.lua index 586cd8c..d1bf6d3 100644 --- a/.config/nvim/lua/nvwynd/plugins/util.lua +++ b/.config/nvim/lua/nvwynd/plugins/util.lua @@ -22,4 +22,10 @@ return { dependencies = { "nvim-lua/plenary.nvim" }, opts = {}, }, + + { + "kylechui/nvim-surround", + event = "VeryLazy", + opts = {}, + }, } diff --git a/.zshrc b/.zshrc index c602689..8a28c1e 100644 --- a/.zshrc +++ b/.zshrc @@ -66,8 +66,8 @@ antigen apply # aliases alias python="python3" alias pip="pip3" -alias ls='exa --icons' -alias ll='exa -alFh --icons' +alias ls='eza --icons' +alias ll='eza -alh -F always --icons' alias grep='rg' alias nv='nvim' diff --git a/README.md b/README.md index bf6cdb6..78c05fb 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,17 @@ Not meant to be directly reused by anybody other than me, you should read what i ## usage -Comes with a small python script to automate the init and deploy procedures by simply copying the files in their required spots based on the `dot.toml` config file. +### install.sh + +Install script for my system, basically a poor man's nix but in bash. Its also used as a very horrible way of keeping track of apps I use on a more than weekly basis. Just call `./install.sh`. + +**Note 1** that it is not a fully automated experience, certain things still require manual user input such as for sudo password, \[y/N\] setups or multiple choice selections. + +**Note 2** Due to certain decisions within the script the apt and flatpak installs are very slow, as I've opted for the stability of the whole script and installing as many apps as possible rather than failing the whole list of apps and continuing if any of them fail, as such the entire script takes ~40 minutes to fully finish. + +### dot.py + +A small python script to automate the init and deploy procedures by simply copying the files in their required spots based on the `dot.toml` config file. `./dot.py --init` to copy all the dotfiles in the currently selected folder diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..6347f10 --- /dev/null +++ b/install.sh @@ -0,0 +1,246 @@ +#!/bin/sh + +# Helper methods, actual script starts at line :110 + +deb_install() { + file=$1 + path=~/Downloads/$1 + url=$2 + download_file $file $url \ + && __install_deb +} + +deb_git_install() { + file=$1 + path=~/Downloads/$1 + repo=$2 + regex=$3 + download_git_release $file $repo $regex \ + && __install_deb +} + +__install_deb() { + sudo apt -f install $path \ + && rm $path +} + +tar_install() { + file=$1 + path=~/Downloads/$2 + url=$3 + strip="${4:-1}" # If no strip param is given assume a strip level of 1 + is_proper="${5:-"false"}" + download_file $file $url \ + && __install_tar $is_proper +} + +tar_git_install() { + file=$1 + path=~/Downloads/$2 + repo=$3 + regex=$4 + strip="${5:-1}" # If no strip param is given assume a strip level of 1 + is_proper="${6:-"false"}" + download_git_release $file $repo $regex \ + && __install_tar $is_proper +} + +__install_tar() { + is_proper=$1 + output=~/.local/lib/$file + if [ "$is_proper" = "true" ]; then + output=~/.local + fi + mkdir -p ~/.local/lib/$file \ + && mkdir -p ~/.local/bin \ + && tar -xaf $path -C $output --strip-components=$strip \ + && rm $path \ + && if [ "$is_proper" = "false" ]; then __link_lib_binary; fi +} + +__link_lib_binary() { + if [ -s ~/.local/lib/$file/$file ]; then + ln -s ~/.local/lib/$file/$file ~/.local/bin/$file + elif [ -s ~/.local/lib/$file/bin/$file ]; then + ln -s ~/.local/lib/$file/bin/$file ~/.local/bin/$file + else + echo "No binary found!" 1>&2 + fi +} + +java_install() { + archive=~/Downloads/java-$1.tar.gz + download_git_release "java-${1}.tar.gz" "adoptium/temurin${1}-binaries" "OpenJDK${1}U-jdk_x64_linux_hotspot_.*tar\.gz" \ + && sudo mkdir /usr/lib/jvm/java-$1-temurin \ + && sudo tar -xf $archive -C /usr/lib/jvm/java-$1-temurin --strip-components 1 \ + && rm $archive +} + +asdf_plugin() { + plugin=$1 + version="${2:-latest}" + asdf plugin add $plugin \ + && asdf install $plugin $version \ + && asdf global $plugin $version +} + +download_git_release() { + file=$1 + repo=$2 + regex=$3 + get_git_release_url $repo $regex \ + && download_file $file $url +} + +download_file() { + path=~/Downloads/$1 + url=$2 + wget --show-progress -qO $path $url +} + +get_git_release_url() { + repo=$1 + regex=$2 + url=$(curl -s https://api.github.com/repos/$repo/releases/latest \ + | grep "browser_download_url.*${regex}\"" \ + | cut -d : -f 2,3 \ + | tr -d \") +} + +# Actual install list + +# Mostly for wine +sudo dpkg --add-architecture i386 + +# GPG Keys +sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key # wine + +# Adding Repositories +sudo mkdir -pm755 /etc/apt/keyrings +sudo add-apt-repository -y universe +sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key + +sudo apt update -yqq + +export PATH=$PATH:/home/$USER/.local/bin + +# Core +packages="make coreutils git apt-transport-https ca-certificates curl wget gnupg lsb-release coreutils sed build-essential \ + firefox git python3-pip zsh mpv figlet lolcat sqlitebrowser flatpak nala \ + ffmpeg libavcodec58 libavcodec-extra ubuntu-restricted-extras \ + gnome-shell-extensions gnome-tweak-tool gnome-menus gnome-user-share dconf-editor gparted alacarte \ + nemo nemo-fileroller nemo-gtkhash \ + pavucontrol gimp inkscape flameshot \ + steam ckb-next lutris discord wine-devel winetricks \ + qemu qemu-kvm virt-manager +" +# Bit crude but it works and if there's any package that cannot be installed it won't fail the entire list +# This _might_ be an apt only issue since -m / --ignore-missing flag doesn't seem to work +# will update if I ever switch to a different package manager +for pkg in $packages; do + sudo apt install -yqqm $pkg +done + +sudo apt upgrade -yqq + +# Set ZSH as default +chsh -s $(which zsh) + +# QEMU / VMM +sudo usermod -aG libvirt,kvm $USER + +# Flatpak +flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo +packages="flathub com.github.tchx84.Flatseal \ + com.github.Eloston.UngoogledChromium \ + org.prismlauncher.PrismLauncher \ + com.github.finefindus.eyedropper \ + com.usebottles.bottles \ + com.obsproject.Studio \ + org.qbittorrent.qBittorrent \ + io.bassi.Amberol \ + org.kde.kdenlive +" +# Same as above but this time there aint even a broken flag for it, it just hard fails at the first +# wrong package, why do people like flatpaks ? +for pkg in $packages; do + flatpak install -yu $pkg +done + +# Cargo +# Note, cargo doesn't have the above issue, if a package is not found, it just skips it +# and tells you a package failed to install, yet another reason why rust is superior +curl https://sh.rustup.rs -sSf | sh +cargo install -q onefetch eza fd-find tokei alacritty stylua git-delta du-dust \ + mdbook mdbook-admonish mdbook-tera stylua dprint +rustup component add rust-src rust-analyzer + +# DEB Installs +deb_install Insomnia.deb "https://updates.insomnia.rest/downloads/ubuntu/latest?&app=com.insomnia.app&source=website" +deb_install OnlyOffice.deb "https://download.onlyoffice.com/install/desktop/editors/linux/onlyoffice-desktopeditors_amd64.deb" +deb_install JDGUI.deb "https://github.com/java-decompiler/jd-gui/releases/download/v1.6.6/jd-gui-1.6.6.deb" +deb_install Minecraft.deb "https://launcher.mojang.com/download/Minecraft.deb" +deb_git_install fastfetch.deb "fastfetch-cli/fastfetch" "fastfetch-linux-amd64.deb" + +# TAR Installs +# Zig's case is special mostly because they don't have the 0.13 builds on github so no tar_git_install for that sadly +tar_install "zig" "zig.tar.xz" "https://ziglang.org/builds/zig-linux-x86_64-0.13.0-dev.340+d750a78b2.tar.xz" +tar_install "nvim" "nvim.tar.xz" "https://github.com/neovim/neovim/releases/download/v0.10.0/nvim-linux64.tar.gz" 1 "true" +tar_git_install "btop" "btop.tbz" "aristocratos/btop" "btop-x86_64-linux-musl.tbz" 2 + +# asdf +git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.0 +. ~/.asdf/asdf.sh +asdf_plugin nodejs +asdf_plugin lua-language-server +# This is kinda needed for prettier plugin below otherwise it won't detect node from asdf +sudo ln -s "$(which node)" /usr/bin/node + +# npm global installs +npm i -g bash-language-server vscode-langservers-extracted pyright prettier + +# pip installs +pip install --user ruff + +# Antigen +curl -L git.io/antigen > ~/antigen.zsh + +# Starship prompt +curl -sS https://starship.rs/install.sh | sh + +# Nerd Fonts +wget -qO ~/Downloads/FiraCode.zip https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/FiraCode.zip +unzip ~/Downloads/FiraCode.zip "*.ttf" "*.otf" -d ${HOME}/.fonts +wget -qO ~/Downloads/JetBrainsMono.zip https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/JetBrainsMono.zip +unzip ~/Downloads/JetBrainsMono.zip "*.ttf" "*.otf" -d ${HOME}/.fonts +sudo fc-cache -f -v + +# Special font for figlet +sudo wget -O "/usr/share/figlet/Red Phoenix.flf" "https://raw.githubusercontent.com/xero/figlet-fonts/master/Red%20Phoenix.flf" + +# Docker +wget -O ~/Downloads/getdocker.sh "https://get.docker.com" \ + && chmod u+x ~/Downloads/getdocker.sh \ + && ~/Downloads/getdocker.sh \ + && sudo groupadd docker \ + && sudo usermod -aG docker $USER \ + && sudo systemctl enable docker.service containerd.service \ + && rm ~/Downloads/getdocker.sh + +# Java +sudo mkdir -p /usr/lib/jvm +java_install 8 +java_install 17 +java_install 21 + +# Set Nemo as default +xdg-mime default nemo.desktop inode/directory application/x-gnome-saved-search +gsettings set org.gnome.desktop.default-applications.terminal exec terminator +gsettings set org.cinnamon.desktop.default-applications.terminal exec terminator + +# Disable automated sleep (only for desktop and plugged in laptops) +gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing' + +if [ -e "./dot.py" ]; then + ./dot.py --deploy +fi diff --git a/scripts/best-gif.sh b/scripts/best-gif.sh new file mode 100755 index 0000000..6416b19 --- /dev/null +++ b/scripts/best-gif.sh @@ -0,0 +1,48 @@ +#!/bin/sh +fps="fps=24" +scale="scale=1080:-1:flags=lanczos" + +usage() { + echo "Usage: $0 [-i ] [-s ] [-r ]" + echo "Options:" + echo " i input file" + echo " s width of the resulting gif" + echo " r frame rate of the resulting gif" +} + +while getopts "s: r: i: h" args; do + case "$args" in + i) + file_name=${OPTARG} + ;; + s) + echo $OPTARG + if [[ $OPTARG =~ ^[0-9]+$ ]]; then + scale="scale=${OPTARG}:-1:flags=lanczos" + else + echo "Error: -s expects an integer." >&2 + exit 1 + fi + ;; + r) + if [[ $OPTARG =~ ^[0-9]+$ ]]; then + rate="fps=${OPTARG}" + else + echo "Error: -r expects an integer." >&2 + exit 1 + fi + ;; + h | * | \?) + usage + exit + ;; + esac +done + +if [ $OPTIND -eq 1 ]; then + usage + exit +fi + + +ffmpeg -i $file_name.mp4 -vf "${fps},${scale},split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" $file_name.gif diff --git a/scripts/make-gif.sh b/scripts/make-gif.sh new file mode 100755 index 0000000..e134bea --- /dev/null +++ b/scripts/make-gif.sh @@ -0,0 +1,47 @@ +#!/bin/sh +rate=5 +scale="scale=-1:-1:flags=lanczos" + +usage() { + echo "Usage: $0 [-i ] [-s ] [-r ]" + echo "Options:" + echo " i input file" + echo " s width of the resulting gif" + echo " r frame rate of the resulting gif" +} + +while getopts "s: r: i: h" args; do + case "$args" in + i) + file_name=${OPTARG} + ;; + s) + echo $OPTARG + if [[ $OPTARG =~ ^[0-9]+$ ]]; then + scale="scale=${OPTARG}:-1:flags=lanczos" + else + echo "Error: -s expects an integer." >&2 + exit 1 + fi + ;; + r) + if [[ $OPTARG =~ ^[0-9]+$ ]]; then + rate=${OPTARG} + else + echo "Error: -r expects an integer." >&2 + exit 1 + fi + ;; + h | * | \?) + usage + exit + ;; + esac +done + +if [ $OPTIND -eq 1 ]; then + usage + exit +fi + +ffmpeg -r ${rate} -i ${file_name}-%d.jpg -vf "${scale}" ${file_name}.gif