From 48aed21b6469d002e15f4c7e37dca0b65cb35d7d Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Mon, 5 Dec 2022 20:00:30 +0000 Subject: [PATCH 01/18] WIP free disk space --- utils/free-up-disk-space.sh | 60 ++++++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/utils/free-up-disk-space.sh b/utils/free-up-disk-space.sh index eeed0dd..39e5523 100644 --- a/utils/free-up-disk-space.sh +++ b/utils/free-up-disk-space.sh @@ -5,7 +5,8 @@ ###################################################################### # Series of commands for freeing up disk space on *nix based systems # # Will ask for user permission before executing or deleting anything # -# Info about current disk usage is printed before starting # +# Info about current disk usage, and recomendations is printed prior # +# Tasks are split into 3 categories: recommended, optional, hardcore # # # # Includes the following tasks: # # - Cleaning package cache for various package managers # @@ -20,3 +21,60 @@ ###################################################################### # Licensed under MIT (C) Alicia Sykes 2022 # ###################################################################### + +function fuds_check_space () { + convert_to_gb() { echo "$(($1/1048576))" ; } + storage_used="$(df --output=used / | tail -n 1)" + storage_free="$(df --output=avail / | tail -n 1)" + storage_total="$(($storage_used + $storage_free))" + math_str="${storage_used} / ${storage_total} * 100" + storage_percent="$(echo "${math_str}" | bc -l)" + echo "Disk ${storage_percent%%.*}% full" + echo "You're using $(convert_to_gb $storage_used) GB out of $(convert_to_gb $storage_total) GB."\ + "($(convert_to_gb $storage_free) GB free)." +} + +fuds_check_space + +function fuds_clean_pacman () { + # Clean pacman cache + sudo pacman -Scc + # Remove orphaned packages + sudo pacman -Rns $(pacman -Qtdq) +} + +function fuds_clean_flatpak () { + # Remove unused Flatpak packages + flatpak uninstall --unused + # Delete Flatpak package cache + sudo rm -rfv /var/tmp/flatpak-cache-* +} + +function fuds_clean_apt () { + # Removes obsolete packages + sudo apt autoremove +} + +function fuds_remove_dead_snaps () { + snap list --all | awk '/disabled/{print $1, $3}' | + while read snapname revision; do + snap remove "$snapname" --revision="$revision" + done +} + +function fuds_journal_configure () { + # Limit size of journal logs to 0.5 GB + journalctl --vacuum-size=500M + # Limit age of journal logs to 1 month + journalctl --vacuum-time=4weeks +} + +function fuds_empty_trash () { + # Delete the current users trash + rm -rf ~/.local/share/Trash/* +} + +function fuds_clear_caches () { + # Remove thumbnails for file viewers + rm -rf ~/.cache/thumbnails/* +} From f44019d91a0a6e55f3d55c9099b3338bfa96e6c4 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Mon, 12 Dec 2022 14:35:06 +0000 Subject: [PATCH 02/18] Adds tokei to Arch installs --- scripts/installs/arch-pacman.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/installs/arch-pacman.sh b/scripts/installs/arch-pacman.sh index 189a7bd..9326d11 100644 --- a/scripts/installs/arch-pacman.sh +++ b/scripts/installs/arch-pacman.sh @@ -27,7 +27,6 @@ pacman_apps=( 'aria2' # Resuming download util (better wget) 'bat' # Output highlighting (better cat) 'broot' # Interactive directory navigation - 'cloc' # Count lines of code in file / dir 'ctags' # Indexing of file info + headers 'diff-so-fancy' # Readable file compares (better diff) 'duf' # Get info on mounted disks (better df) @@ -44,6 +43,7 @@ pacman_apps=( 'thefuck' # Auto-correct miss-typed commands 'tealdeer' # Reader for command docs (better man) 'tree' # Directory listings as tree structure + 'tokei' # Count lines of code (better cloc) 'trash-cli' # Record and restore removed files 'xsel' # Copy paste access to the X clipboard 'zoxide' # Auto-learning navigation (better cd) From c3fcb254b9479e8154dc4850af3f38a3b4b21bfc Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Wed, 14 Dec 2022 14:36:06 +0000 Subject: [PATCH 03/18] Updates dep list in readme --- .github/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/README.md b/.github/README.md index c20852f..6d06e36 100644 --- a/.github/README.md +++ b/.github/README.md @@ -653,6 +653,7 @@ The following section lists apps installed for each category: - [`jq`](https://github.com/stedolan/jq) - JSON parser - [`most`](https://www.jedsoft.org/most/) - Multi-window scroll pager _(better less)_ - [`procs`](https://github.com/dalance/procs) - Advanced process viewer _(better ps)_ +- [`rip`](https://github.com/nivekuil/rip) - Safe and ergonomic deletion tool _(better rm)_ - [`ripgrep`](https://github.com/BurntSushi/ripgrep) - Searching within files _(better grep)_ - [`rsync`](https://rsync.samba.org/) - Fast, incremental file transfer - [`scc`](https://github.com/boyter/scc) - Count lines of code _(better cloc)_ @@ -677,6 +678,7 @@ The following section lists apps installed for each category: - [`gping`](https://github.com/orf/gping) - Interactive ping tool, with graph - [`ncdu`](https://dev.yorhel.nl/ncdu) - Disk usage analyzer and monitor _(better du)_ - [`speedtest-cli`](https://github.com/sivel/speedtest-cli) - Command line speed test utility +- [`dog`](https://github.com/ogham/dog) - DNS lookup client _(better dig)_ @@ -700,6 +702,7 @@ The following section lists apps installed for each category: - [`httpie`](https://httpie.io/) - HTTP / API testing testing client - [`lazydocker`](https://github.com/jesseduffield/lazydocker) - Full Docker management app - [`lazygit`](https://github.com/jesseduffield/lazygit) - Full Git managemtne app +- [`kdash`](https://github.com/kdash-rs/kdash/) - Kubernetes dashboard app From ebda15d73a0b34b96168a3f1283e5b57c69ebc11 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sun, 18 Dec 2022 14:36:54 +0000 Subject: [PATCH 04/18] Replaces SCC with tokei for line counting --- scripts/installs/Brewfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/installs/Brewfile b/scripts/installs/Brewfile index 390528a..211fc49 100644 --- a/scripts/installs/Brewfile +++ b/scripts/installs/Brewfile @@ -53,10 +53,10 @@ brew 'most' # Multi-window scroll pager (better less) brew 'procs' # Advanced process viewer (better ps) brew 'ripgrep' # Searching within files (better grep) brew 'rsync' # Fast incremental file transfer -brew 'scc' # Count lines of code (better cloc) brew 'sd' # RegEx find and replace (better sed) brew 'thefuck' # Auto-correct miss-typed commands brew 'tldr' # Community-maintained docs (better man) +brew 'tokei' # Count lines of code (better cloc) brew 'tree' # Directory listings as tree structure brew 'trash-cli' # Record and restore removed files brew 'watch' # Run commands periorically From 41653a4f16060d11891e26f7e80d5f7ad96cce79 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sun, 18 Dec 2022 14:37:46 +0000 Subject: [PATCH 05/18] Adds link to alacritty.yml to symlinks --- symlinks.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/symlinks.yaml b/symlinks.yaml index 050ad9b..733d8dd 100644 --- a/symlinks.yaml +++ b/symlinks.yaml @@ -18,7 +18,6 @@ ${XDG_CONFIG_HOME}/vim: config/vim ${XDG_CONFIG_HOME}/nvim: config/vim ${XDG_CONFIG_HOME}/tmux: config/tmux - ${XDG_CONFIG_HOME}/fish/config.fish: config/config.fish ${XDG_DATA_HOME}/tmux/tpm: lib/tpm ${XDG_DATA_HOME}/tmux/plugins/tpm: lib/tpm @@ -29,6 +28,9 @@ ${XDG_CONFIG_HOME}/.gitignore_global: config/general/.gitignore_global ${XDG_CONFIG_HOME}/.wgetrc: config/general/.wgetrc + # Desktop Apps + ${XDG_CONFIG_HOME}/alacritty.yml: config/desktop-apps/alacritty.yml + # Bash utils ${XDG_CONFIG_HOME}/utils: utils From f1728b2a0357151f21320ba1efb5bd18be3a23f9 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sun, 18 Dec 2022 22:12:05 +0000 Subject: [PATCH 06/18] Adds license link to end of readme --- .github/README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/README.md b/.github/README.md index 3e5dbba..ba25946 100644 --- a/.github/README.md +++ b/.github/README.md @@ -1143,3 +1143,29 @@ bash <(curl -s https://raw.githubusercontent.com/Lissy93/dotfiles/master/utils/w --- + +--- + + + +

+ © Alicia Sykes 2022
+ Licensed under MIT
+
+ Thanks for visiting :) +

+ + + + From 38a2c2a9b93ff4d65a614021669dce19626e62fe Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Mon, 19 Dec 2022 20:46:56 +0000 Subject: [PATCH 07/18] Resolve conflict --- utils/qr-code.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/utils/qr-code.sh b/utils/qr-code.sh index c521f9e..79923bd 100644 --- a/utils/qr-code.sh +++ b/utils/qr-code.sh @@ -21,14 +21,8 @@ getConfiguredClient () { fi } -<<<<<<< HEAD -## Allows to call the users configured client without if statements everywhere -httpGet() -{ -======= # Call appropriate http get method httpGet() { ->>>>>>> fe6ffbba54ca34778e1f4245466e1efc3394b896 case "$configuredClient" in curl) curl -A curl -s "$@" ;; wget) wget -qO- "$@" ;; From f8e551e98d35ef074aaf7e2a9aaa04d7fb4af4eb Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Wed, 21 Dec 2022 21:58:03 +0000 Subject: [PATCH 08/18] Puts file structure in table --- scripts/README.txt | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/scripts/README.txt b/scripts/README.txt index 50ed569..cb1dce1 100644 --- a/scripts/README.txt +++ b/scripts/README.txt @@ -4,20 +4,27 @@ Lissy93/Dotfiles - Scripts 📜 A set of Bash scripts for automating the setup and management of various systems. -dotfiles/scripts/ -├── installs/ -│ ├── arch-pacman.sh Package installations using via for Arch-based systems -│ ├── Brewfile Packages to be installed via Homebrew on MacOS -│ ├── flatpak.sh Desktop apps to be installed on Linux GUI systems via Flatpak -│ ├── alpine-pkg.sh Package installations using pkg for Alpine-based systems -│ └── prerequisites.sh Cross-distro installation of prerequisite core packages -├── linux/ -│ └── dconf-prefs.sh Apply preferences to (mostly GNOME apps) via dconf utility -└── macos-setup/ - ├── macos-apps.sh Apply preferences to user applications (Finder, Mail, Terminal, etc) - ├── macos-prefs.sh Apply user MacOS preferences (spotlight, colors, behaviour, etc) - └── macos-security.sh Apply essential MacOS security settings +╭───────────────────────────┬─────────────────────────────────────────────────────────────────╮ +│ File Path │ Description │ +╞═══════════════════════════╪═════════════════════════════════════════════════════════════════╡ +│ dotfiles/scripts/ │ │ +│ ├── installs/ │ │ +│ │ ├── arch-pacman.sh │ Package installations using via for Arch-based systems │ +│ │ ├── Brewfile │ Packages to be installed via Homebrew on MacOS │ +│ │ ├── flatpak.sh │ Desktop apps to be installed on Linux GUI systems via Flatpak │ +│ │ ├── alpine-pkg.sh │ Package installations using pkg for Alpine-based systems │ +│ │ ├── debian-apt.sh │ Package installs via apt-get for Ubuntu / Debain-based systems │ +│ │ └── prerequisites.sh │ Cross-distro installation of prerequisite core packages │ +│ ├── linux/ │ │ +│ │ └── dconf-prefs.sh │ Apply preferences to (mostly GNOME apps) via dconf utility │ +│ └── macos-setup/ │ │ +│ ├── macos-apps.sh │ Apply preferences to user applications │ +│ ├── macos-prefs.sh │ Apply user MacOS system preferences │ +│ └── macos-security.sh │ Apply essential MacOS security settings │ +╰───────────────────────────┴─────────────────────────────────────────────────────────────────╯ -Source: https://github.com/Lissy93/dotfiles/tree/master/scripts -Licensed under MIT (C) Alicia Sykes 2022 +┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ +┃ Source: https://github.com/Lissy93/dotfiles/tree/master/scripts ┃ +┃ Licensed under MIT (C) Alicia Sykes 2022 ┃ +┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ From 7cad45f8f76ee1b177741f51e919f2cc7d51e6a3 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Wed, 21 Dec 2022 22:18:38 +0000 Subject: [PATCH 09/18] Adds readme for scripts/installs --- scripts/installs/README.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 scripts/installs/README.txt diff --git a/scripts/installs/README.txt b/scripts/installs/README.txt new file mode 100644 index 0000000..59f1fd2 --- /dev/null +++ b/scripts/installs/README.txt @@ -0,0 +1,13 @@ +Lissy93/Dotfiles - Scripts for Package Installs 📥 +------------------------------------------------- + +Each of these scripts is used to automate the installation and updates of packages, across various OSs +Specific usage instructions can be found in a comment, at the top of each file - read before running +Files can either be run directly, or can be invoked (based on system type) when you run install.sh +Be sure to check the contents of any file, and modify to your liking before executing anything +Currently only MacOS, Arch-based systems, Debian-based systems and Windows are supported + +┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ +┃ Source: https://github.com/Lissy93/dotfiles/tree/master/scripts ┃ +┃ Licensed under MIT (C) Alicia Sykes 2022 ┃ +┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ From f9fb9361d92f4ebb6a15045d43870272ddb46180 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Thu, 22 Dec 2022 21:12:46 +0000 Subject: [PATCH 10/18] remove blankline --- config/README.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/config/README.txt b/config/README.txt index 9c92aad..023f303 100644 --- a/config/README.txt +++ b/config/README.txt @@ -9,8 +9,10 @@ Run the install.sh script to apply settings based on system type and user prefer Important: Take care to read through files thoroughly before applying any changes And always make a backup of your pre-existing config files before over-writing them -Full source and documentation: https://github.com/Lissy93/dotfiles -Licensed under MIT (C) Alicia Sykes 2022 +┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ +┃ Source: https://github.com/Lissy93/dotfiles/tree/master/scripts ┃ +┃ Licensed under MIT (C) Alicia Sykes 2022 ┃ +┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ --- From 15b893a2790f84bcd6f4b2c303dad0f61bf06749 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sat, 24 Dec 2022 18:23:24 +0000 Subject: [PATCH 11/18] Executes zoxide if needed --- config/zsh/.zshrc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/zsh/.zshrc b/config/zsh/.zshrc index 5a6b45c..1b43e03 100644 --- a/config/zsh/.zshrc +++ b/config/zsh/.zshrc @@ -60,6 +60,11 @@ if [ "$(uname -s)" = "Darwin" ] && [[ -d "${HOME}/Library/Android/" ]]; then export NODE_BINARY="/usr/local/bin/node" fi +# Add Zoxide (for cd, quick jump) to shell +if hash zoxide 2> /dev/null; then + eval "$(zoxide init zsh)" +fi + # If not running in nested shell, then show welcome message :) if [[ "${SHLVL}" -lt 2 ]] && [[ -z "$SKIP_WELCOME" ]]; then welcome From 4b73346638b5c3c3124a62726f6df8df95a28139 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sat, 24 Dec 2022 18:25:22 +0000 Subject: [PATCH 12/18] Adds stuff in dconf prefs applier --- scripts/linux/dconf-prefs.sh | 52 +++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/scripts/linux/dconf-prefs.sh b/scripts/linux/dconf-prefs.sh index 0194d84..e66b7d6 100644 --- a/scripts/linux/dconf-prefs.sh +++ b/scripts/linux/dconf-prefs.sh @@ -1,29 +1,30 @@ #!/bin/bash +######################################################################## +# Sets app preferences on Linux via dconf # ######################################################################## # Uses dconf to apply application preferences on Linux GNOME desktops # -# Creates a backup of current settings, then prompt to load new config # +# Reads source files from ./config/gnome/*.dconf ($DCONF_SOURCE_DIR) # +# Creates a backup of current settings, then loads + saves new config # # IMPORTANT: Be sure to read files through thoughouly before executing # ######################################################################## # Licensed under MIT (C) Alicia Sykes 2022 # ######################################################################## # Color variables -PRIMARY_COLOR='\033[1;33m' -ACCENT_COLOR='\033[0;34m' -INFO_COLOR='\033[0;30m' -INFO_COLOR_U='\033[4;30m' -SUCCESS_COLOR='\033[0;32m' +PRIMARY_COLOR='\033[1;34m' +ACCENT_COLOR='\033[0;96m' ERROR_COLOR='\033[1;31m' -WARN_1='\033[1;31m' -WARN_2='\033[0;31m' +WARN_COLOR='\033[0;33m' +SUCCESS_COLOR='\033[0;32m' RESET='\033[0m' ITAL='\e[3m' -UNDAL='\e[4m' PALE='\e[2m' -BOLD='\e[1m' +UNDAL='\e[4m' +# Set config variables PARAMS=$* +FILE_EXT='dconf' show_help () { echo -e "${PRIMARY_COLOR}🐧 Linux Desktop Preferences${RESET_COLOR}\n"\ @@ -32,12 +33,14 @@ show_help () { "./config/gnome and applied to the dconf database in ~/.config/dconf/[user]\n"\ "Before any changes are made, existing settings are backed up to ~/.cache/dconf-backups/\n"\ "\n The following applications will be configured:\n"\ + " - Terminal\n"\ " - Calculator\n"\ " - Evolution\n"\ " - Geddit\n"\ " - gThumb\n"\ " - Todo App\n"\ - "\n${BOLD}⚠ Be sure that you've read and unserstood which changes will be applied before proceeding${RESET}\n" + "\n${WARN_COLOR}⚠ Be sure that you've read and unserstood which"\ + "changes will be applied before proceeding${RESET}\n" } # If --help flag passed in, just show the help menu @@ -53,7 +56,8 @@ if [[ ! $PARAMS == *"--yes-to-all"* ]]; then echo -e "\n${PRIMARY_COLOR}Would you like to proceed? (y/N)${RESET}" read -t 15 -n 1 -r if [[ ! $REPLY =~ ^[Yy]$ ]]; then - echo -e "${ACCENT_COLOR}\nNo worries, nothing will be applied - feel free to come back another time." + echo -e "${ACCENT_COLOR}\nNo worries, nothing will be applied"\ + "- feel free to come back another time." echo -e "${PRIMARY_COLOR}Exiting...${RESET}" exit 0 else @@ -77,7 +81,7 @@ fi # Set locations for where to store backups, and where to read new configs from DCONF_BACKUP_DIR="${DCONF_BACKUP_DIR:-${XDG_CACHE_HOME}/dconf-backups}" DCONF_BACKUP_FILE=${DCONF_BACKUP_FILE:-"backup_"`date +"%Y-%m-%d_%H-%M-%S"`} -DCONF_SOURCE_DIR="$(cd "$(dirname "$0")" && pwd)/../../config/gnome" +DCONF_SOURCE_DIR="${DOTFILES_DIR:-"$(cd "$(dirname "$0")" && pwd)/../.."}/config/gnome" # Create directory to store backups DCONF_BACKUP_PATH="${DCONF_BACKUP_DIR}/${DCONF_BACKUP_FILE}" @@ -106,7 +110,7 @@ apply_dconf () { fi # Check source file exists - if [ ! -f "$DCONF_SOURCE_DIR/$dconf_name.toml" ]; then + if [ ! -f "$DCONF_SOURCE_DIR/$dconf_name.$FILE_EXT" ]; then echo -e "${ERROR_COLOR}⚠ Error, the specified config file for"\ "'${dconf_name}' doesn't exist in ${DCONF_SOURCE_DIR}${RESET}" return @@ -114,22 +118,22 @@ apply_dconf () { # Make backup of existing settings echo -e "${PRIMARY_COLOR}Applying ${dconf_name} config${RESET}" - dconf dump $dconf_key > "${DCONF_BACKUP_PATH}/${dconf_name}.toml" + dconf dump $dconf_key > "${DCONF_BACKUP_PATH}/${dconf_name}.$FILE_EXT" # Apply new settings from file - echo -e "${ACCENT_COLOR}✓ ${dconf_name} settings succesfully applies to ${dconf_key}${RESET}" - dconf load $dconf_key < $DCONF_SOURCE_DIR/${dconf_name}.toml + echo -e "${SUCCESS_COLOR}✓ ${dconf_name} settings succesfully applies to ${dconf_key}${RESET}" + dconf load $dconf_key < $DCONF_SOURCE_DIR/${dconf_name}.$FILE_EXT # Print instructions on reverting changes - echo -e "${ACCENT_COLOR}${ITAL}To revert, run $"\ - "dconf load $dconf_key < $DCONF_BACKUP_PATH/${dconf_name}.toml${RESET}\n" + echo -e "${ACCENT_COLOR}${ITAL}${PALE}To revert, run $"\ + "${UNDAL}dconf load $dconf_key < $DCONF_BACKUP_PATH/${dconf_name}.$FILE_EXT${RESET}\n" } # For the following dconf keys, apply settings in from the specified files -apply_dconf '/org/gnome/calculator/' 'calculator' -apply_dconf '/org/gnome/evolution/' 'evolution' -apply_dconf '/org/gnome/gedit/preferences/' 'gedit' -apply_dconf '/org/gnome/gthumb/' 'gthumb' -apply_dconf '/org/gnome/todo/' 'todo' +apply_dconf '/org/gnome/calculator/' 'calculator' # Apply calculator settings +apply_dconf '/org/gnome/evolution/' 'evolution' # Apply Evolution (mail client) settings +apply_dconf '/org/gnome/gedit/preferences/' 'gedit' # Apply Gedit (text editor) settings +apply_dconf '/org/gnome/gthumb/' 'gthumb' # Apply gthumb (image editor) settings +apply_dconf '/org/gnome/todo/' 'todo' # Apply todo list app settings # EOF \ No newline at end of file From 277af4fa53a3927b70b5360f6b44aacecdd34e41 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Fri, 13 Jan 2023 22:27:18 +0000 Subject: [PATCH 13/18] Replaces ncdu with brew dua-cli --- scripts/installs/Brewfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/installs/Brewfile b/scripts/installs/Brewfile index 211fc49..e768492 100644 --- a/scripts/installs/Brewfile +++ b/scripts/installs/Brewfile @@ -67,10 +67,10 @@ brew 'zoxide' # Auto-learning navigation (better cd) brew 'bmon' # Bandwidth utilization monitor brew 'ctop' # Container metrics and monitoring brew 'bpytop' # Resource monitoring (like htop) +brew 'dua-cli' # Disk usage analyzer and monitor (better du) brew 'glances' # Resource monitor + web and API brew 'goaccess' # Web log analyzer and viewer brew 'gping' # Interactive ping tool, with graph -brew 'ncdu' # Disk usage analyzer and monitor (better du) brew 'speedtest-cli'# Command line speed test utility # CLI Productivity Apps From 36a54590acd78ca9d837ec8043526191f7b6228b Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sat, 14 Jan 2023 15:42:57 +0000 Subject: [PATCH 14/18] Fixes broken link to installs --- .github/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/README.md b/.github/README.md index ba25946..be4d0a8 100644 --- a/.github/README.md +++ b/.github/README.md @@ -613,7 +613,7 @@ Alias | Description The dotfile installation script can also, detect which system and environemnt you're running, and optionally prompt to update and install listed packages and applications. -Package lists are stored in [`scripts/installs/`](https://github.com/Lissy93/dotfiles/tree/master/installs) directory, with separate files for different OSs. The install script will [pick the appropriate file](https://github.com/Lissy93/dotfiles/blob/22c6a04fdb22c140448b7d15ef8187c3a424ab47/install.sh#L243-L260) based on your distro. +Package lists are stored in [`scripts/installs/`](https://github.com/Lissy93/dotfiles/tree/master/scripts/installs) directory, with separate files for different OSs. The install script will [pick the appropriate file](https://github.com/Lissy93/dotfiles/blob/22c6a04fdb22c140448b7d15ef8187c3a424ab47/install.sh#L243-L260) based on your distro. You will be prompted before anything is installed. Be sure to remove / comment out anything you do not need before proceeding. From 533d9917def7ca29b0892da4a4a0c7f4838b91cf Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sat, 11 Feb 2023 15:53:49 +0000 Subject: [PATCH 15/18] Updates the clone function, to handle SSH --- config/zsh/aliases/git.zsh | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/config/zsh/aliases/git.zsh b/config/zsh/aliases/git.zsh index ed7f705..dbe0678 100644 --- a/config/zsh/aliases/git.zsh +++ b/config/zsh/aliases/git.zsh @@ -95,12 +95,14 @@ alias gj='jump-to-git-root' function clone { default_service='github.com' # Used if full URL isn't specified default_username='lissy93' # Used if repo org / username isn't specified + use_ssh=true # Use SSH instead of HTTPS user_input=$1 target=${2:-''} # Help flag passed, show manual and exit if [[ $user_input == --help ]] || [[ $user_input == -h ]]; then - echo -e 'This will clone a git repo'; - echo -e 'Either specify repo name, user/repo, or a full URL' + echo -e 'This will clone a git repo, and cd into it.'; + echo -e 'Either specify repo name, oe user/repo, or a full URL.' + echo -e 'If no target directory is specified, the repo name will be used.' echo -e 'E.g. `$ clone lissy93/dotfiles`' return; # No input specified, prompt user @@ -108,7 +110,6 @@ function clone { echo 'Enter a user/repo or full URL: '; read user_input; fi - echo "$target" # Determine input type, and make clone url if [[ $user_input == git@* || $user_input == *://* ]] then @@ -116,10 +117,18 @@ function clone { REPO_URL=$user_input; elif [[ $user_input == */* ]]; then # Username/repo was provided - REPO_URL="https://$default_service/$user_input.git"; + if [ "$use_ssh" = true ] ; then + REPO_URL="git@$default_service:$user_input.git"; + else + REPO_URL="https://$default_service/$user_input.git"; + fi else # Just repo name was provided - REPO_URL="https://$default_service/$default_username/$user_input.git"; + if [ "$use_ssh" = true ] ; then + REPO_URL="git@$default_service:$default_username/$user_input.git"; + else + REPO_URL="https://$default_service/$default_username/$user_input.git"; + fi fi # Clone repo @@ -127,6 +136,13 @@ function clone { # cd into newly cloned directory cd "$(basename "$_" .git)" + + # Print results + if test "$?" -eq 0; then + echo -e "☑️ \033[1;96mCloned $REPO_URL into $(pwd), and cd'd into it.\033[0m" + else + echo -e "❌ \033[1;91mFailed to clone $REPO_URL\033[0m" + fi } # Sync fork against upstream repo From acf411dc59c206a0b3e7ec993e1e56ee5af2ce5f Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Wed, 15 Feb 2023 23:20:24 +0000 Subject: [PATCH 16/18] Adds manual and more comprehenive options --- utils/free-up-disk-space.sh | 152 +++++++++++++++++++++++++++++++++++- 1 file changed, 150 insertions(+), 2 deletions(-) diff --git a/utils/free-up-disk-space.sh b/utils/free-up-disk-space.sh index 39e5523..9c4f192 100644 --- a/utils/free-up-disk-space.sh +++ b/utils/free-up-disk-space.sh @@ -22,6 +22,16 @@ # Licensed under MIT (C) Alicia Sykes 2022 # ###################################################################### +# Color Variables +CYAN_B='\033[1;96m' +YELLOW_B='\033[1;93m' +RED_B='\033[1;31m' +GREEN_B='\033[1;32m' +PLAIN_B='\033[1;37m' +RESET='\033[0m' +GREEN='\033[0;32m' +PURPLE='\033[0;35m' + function fuds_check_space () { convert_to_gb() { echo "$(($1/1048576))" ; } storage_used="$(df --output=used / | tail -n 1)" @@ -34,8 +44,6 @@ function fuds_check_space () { "($(convert_to_gb $storage_free) GB free)." } -fuds_check_space - function fuds_clean_pacman () { # Clean pacman cache sudo pacman -Scc @@ -56,6 +64,7 @@ function fuds_clean_apt () { } function fuds_remove_dead_snaps () { + # Remove disabled snaps snap list --all | awk '/disabled/{print $1, $3}' | while read snapname revision; do snap remove "$snapname" --revision="$revision" @@ -78,3 +87,142 @@ function fuds_clear_caches () { # Remove thumbnails for file viewers rm -rf ~/.cache/thumbnails/* } + +function fuds_remove_duplicates () { + # Find and prompt to delete duplicated files + fdupes . -G 10 --size -S -n -t -d +} + +function fuds_remove_broken () { + # Remove broken symlinks + find . -xtype l -delete + # Remove empty files + find . -type f -empty -delete + # Remove empty folders + find . -type d -empty -delete +} + +function fuds_show_help () { + echo "Usage: free-up-disk-space [OPTION]" + echo "Free up disk space on *nix based systems" + echo "" + echo "Options:" + echo " -h, --help Show this help message" + echo " -r, --run Run all tasks" + echo " -p, --pacman Clean pacman cache and remove orphaned packages" + echo " -f, --flatpak Remove unused Flatpak packages and delete cache" + echo " -a, --apt Remove obsolete packages" + echo " -s, --snaps Remove disabled snaps" + echo " -j, --journal Configure journal logs" + echo " -t, --trash Empty trash" + echo " -c, --caches Remove thumbnails and other caches" + echo " -d, --dups Find and delete duplicated files" + echo " -b, --broken Remove broken symlinks and empty files + folders" + echo "" + echo "Examples:" + echo " free-up-disk-space -r" + echo " free-up-disk-space -p -f -a -s -j -t -c -d -b" +} + +function free_up_disk_space () { + # Check available disk space + fuds_check_space + + # Prompt to clean pacman cache + echo -e "\n${CYAN_B}Would you like to clean pacman cache? (y/N)${RESET}" + read -n 1 -r ans_clean_pacman + if [[ $ans_clean_pacman =~ ^[Yy]$ ]] || [[ $AUTO_YES = true ]] ; then + fuds_clean_pacman + fi + + # Prompt to remove unused Flatpak packages + echo -e "\n${CYAN_B}Would you like to remove unused Flatpak packages? (y/N)${RESET}" + read -n 1 -r ans_clean_flatpak + if [[ $ans_clean_flatpak =~ ^[Yy]$ ]] || [[ $AUTO_YES = true ]] ; then + fuds_clean_flatpak + fi + + # Prompt to remove obsolete packages + echo -e "\n${CYAN_B}Would you like to remove obsolete packages? (y/N)${RESET}" + read -n 1 -r ans_clean_apt + if [[ $ans_clean_apt =~ ^[Yy]$ ]] || [[ $AUTO_YES = true ]] ; then + fuds_clean_apt + fi + + # Prompt to remove disabled snaps + echo -e "\n${CYAN_B}Would you like to remove disabled snaps? (y/N)${RESET}" + read -n 1 -r ans_remove_dead_snaps + if [[ $ans_remove_dead_snaps =~ ^[Yy]$ ]] || [[ $AUTO_YES = true ]] ; then + fuds_remove_dead_snaps + fi + + # Prompt to configure journal logs + echo -e "\n${CYAN_B}Would you like to configure journal logs? (y/N)${RESET}" + read -n 1 -r ans_journal_configure + if [[ $ans_journal_configure =~ ^[Yy]$ ]] || [[ $AUTO_YES = true ]] ; then + fuds_journal_configure + fi + + # Prompt to empty trash + echo -e "\n${CYAN_B}Would you like to empty trash? (y/N)${RESET}" + read -n 1 -r ans_empty_trash + if [[ $ans_empty_trash =~ ^[Yy]$ ]] || [[ $AUTO_YES = true ]] ; then + fuds_empty_trash + fi + + # Prompt to remove thumbnails and other caches + echo -e "\n${CYAN_B}Would you like to remove thumbnails and other caches? (y/N)${RESET}" + read -n 1 -r ans_clear_caches + if [[ $ans_clear_caches =~ ^[Yy]$ ]] || [[ $AUTO_YES = true ]] ; then + fuds_clear_caches + fi + + # Prompt to find and delete duplicated files + echo -e "\n${CYAN_B}Would you like to find and delete duplicated files? (y/N)${RESET}" + read -n 1 -r ans_remove_duplicates + if [[ $ans_remove_duplicates =~ ^[Yy]$ ]] || [[ $AUTO_YES = true ]] ; then + fuds_remove_duplicates + fi + + # Prompt to remove broken symlinks and empty files + folders + echo -e "\n${CYAN_B}Would you like to remove broken symlinks and empty files + folders? (y/N)${RESET}" + read -n 1 -r ans_remove_broken + if [[ $ans_remove_broken =~ ^[Yy]$ ]] || [[ $AUTO_YES = true ]] ; then + fuds_remove_broken + fi +} + +# Determine if file is being run directly or sourced +([[ -n $ZSH_EVAL_CONTEXT && $ZSH_EVAL_CONTEXT =~ :file$ ]] || + [[ -n $KSH_VERSION && $(cd "$(dirname -- "$0")" && + printf '%s' "${PWD%/}/")$(basename -- "$0") != "${.sh.file}" ]] || + [[ -n $BASH_VERSION ]] && (return 0 2>/dev/null)) && sourced=1 || sourced=0 + +# If script being called directly, invoke transfer or show help +if [ $sourced -eq 0 ]; then + if [[ $@ == *"--help"* ]]; then + fuds_show_help + elif [[ $@ == *"--pacman"*]]; then + fuds_clean_pacman + elif [[ $@ == *"--flatpak"*]]; then + fuds_clean_flatpak + elif [[ $@ == *"--apt"*]]; then + fuds_clean_apt + elif [[ $@ == *"--snaps"*]]; then + fuds_remove_dead_snaps + elif [[ $@ == *"--journal"*]]; then + fuds_journal_configure + elif [[ $@ == *"--trash"*]]; then + fuds_empty_trash + elif [[ $@ == *"--caches"*]]; then + fuds_clear_caches + elif [[ $@ == *"--dups"*]]; then + fuds_remove_duplicates + elif [[ $@ == *"--broken"*]]; then + fuds_remove_broken + elif [[ $@ == *"--run"*]]; then + free_up_disk_space + else + free_up_disk_space + fi +fi From e839ab2d77f0be0d09b4f4ba3503c8b69ad925f3 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Thu, 16 Feb 2023 21:46:31 +0000 Subject: [PATCH 17/18] Adds Linux desktop apps, productivity, media and security --- scripts/installs/flatpak.sh | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/scripts/installs/flatpak.sh b/scripts/installs/flatpak.sh index fce8a40..03040dd 100644 --- a/scripts/installs/flatpak.sh +++ b/scripts/installs/flatpak.sh @@ -34,6 +34,7 @@ flatpak_apps=( 'org.jitsi.jitsi-meet' # Encrypted video calls 'org.mozilla.Thunderbird' # Email + calendar client 'org.signal.Signal' # Private messenger, mobile + 'im.pidgin.Pidgin' # Extendable XMPP chat client 'com.slack.Slack' # Work and team messaging 'com.github.eneshecan.WhatsAppForLinux' # WhatApp client @@ -44,10 +45,13 @@ flatpak_apps=( 'org.gnome.Cheese' # Webcam client 'org.libretro.RetroArch' # Retro game emulation 'org.videolan.VLC' # Media player + 'com.github.johnfactotum.Foliate' # E-book reader + 'tech.feliciano.pocket-casts' # Podcast client # Creativity 'com.ultimaker.cura' # 3D slicing 'com.obsproject.Studio' # Video streaming + 'com.jgraph.drawio.desktop' # UML + Diagram tool 'com.transmissionbt.Transmission' # Torrent downloader 'com.uploadedlobster.peek' # Screen recorder 'fr.handbrake.ghb' # Video transcoder @@ -60,13 +64,14 @@ flatpak_apps=( 'org.inkscape.Inkscape' # Vector editor 'org.shotcut.Shotcut' # Video editor 'org.synfig.SynfigStudio' # 2D animation - + # Software development 'com.visualstudio.code' # Extendable IDE 'com.getpostman.Postman' # API development 'cc.arduino.IDE2' # IOT development 'com.axosoft.GitKraken' # GUI git client 'com.google.AndroidStudio' # Android dev IDE + 'flathub org.gnome.GHex' # Hex and binary inspector 'io.podman_desktop.PodmanDesktop' # Docker / Podman UI # Security testing @@ -76,16 +81,22 @@ flatpak_apps=( # Settings and system utils 'com.borgbase.Vorta' # Borg backup client + 'org.kde.kleopatra' # GPG key and certificate manager + 'io.github.jacalz.rymdport' # Encrypted file transfers, via Wormhole + 'org.bleachbit.BleachBit' # Disk cleaner and log remover + 'it.mijorus.smile' # Emoji picker - # Browsers - 'org.mozilla.firefox' - 'com.github.Eloston.UngoogledChromium' - 'com.github.micahflee.torbrowser-launcher' + # Browsers and internet + 'org.mozilla.firefox' # Firefox web browser (primary) + 'com.github.Eloston.UngoogledChromium' # Chomium-based borwser (secondary) + 'com.github.micahflee.torbrowser-launcher' # Tor browser + 'org.filezillaproject.Filezilla' # FTP client # Office 'org.libreoffice.LibreOffice' # Office suite - 'org.cvfosammmm.Setzer' # LaTeX editor - + 'net.xm1math.Texmaker' # LaTeX editor + 'md.obsidian.Obsidian' # Markdown editor + # Personal 'ch.protonmail.protonmail-bridge' # ProtonMail bridge 'com.belmoussaoui.Authenticator' # OTP authenticator From 5221bc3622092ffb1bb04f2ed740cd10fbb51218 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Thu, 16 Feb 2023 22:02:57 +0000 Subject: [PATCH 18/18] Grammar improvemnts in readme --- .github/README.md | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/README.md b/.github/README.md index be4d0a8..1ce3c9b 100644 --- a/.github/README.md +++ b/.github/README.md @@ -59,7 +59,9 @@ This is important, because as a developer, we usually have multiple machines (wo ### XDG Directories -The location of most config files can be defined using the [XDG base directory specification](https://specifications.freedesktop.org/basedir-spec), which is honored by most apps. This lets you specify where config, log, cache and data files are stored, keeping your top-level home directory free from clutter. You can do this by setting environmental variables, usually within the [`.zshenv`](https://github.com/Lissy93/dotfiles/blob/master/config/zsh.zshenv) file. +The location of config files can usually be defined using the [XDG base directory specification](https://specifications.freedesktop.org/basedir-spec), which is honored by most apps. This lets you specify where config, log, cache and data files are stored, keeping your top-level home directory free from clutter. You can do this by setting environmental variables, usually within the [`.zshenv`](https://github.com/Lissy93/dotfiles/blob/master/config/zsh.zshenv) file. + +For example, in my setup I've [set these variables](https://github.com/Lissy93/dotfiles/blob/e839ab2d77f0be0d09b4f4ba3503c8b69ad925f3/config/zsh/.zshenv#L6=L10) to: Variable | Location --- | --- @@ -77,17 +79,21 @@ You can also containerize your dotfiles, meaning with a single command, you can This is awesome for a number of reasons: 1) Super minimal dependency installation on the host 2) Blazing fast, as you can pull your built image from a registry, instead of compiling everything locally 3) Cross-platform compatibility, whatever your host OS is, you can always have a familiar Linux system in the container 4) Security, you can control which host resources are accessible within each container -For this, I'm using an Alpine-based Docker container defined in the [`Dockerfile`](https://github.com/Lissy93/dotfiles/blob/master/Dockerfile), to try it out, just run `docker run lissy93/dotfiles`. +There's several methods of doing this, like having a Docker container or spinning up VMs with a predefined config (with something like [Vagrant](https://www.vagrantup.com/) or a [NixOS](https://nixos.org/)-based config). -Other options could include spinning up VMs with a predefined config, either using something like [Vagrant](https://www.vagrantup.com/) or a [NixOS](https://nixos.org/)-based config. +I went with an Alpine-based Docker container defined in the [`Dockerfile`](https://github.com/Lissy93/dotfiles/blob/master/Dockerfile). To try it out, just run `docker run lissy93/dotfiles`. --- ### Security -Something that is important to keep in mind, is security. Often you may have some personal info included in some of your dotfiles. Before storing anything on the internet, double check there's no sensitive info, SSH keys, API keys or plaintext passwords. If you're using git, then any files you wouldn't want to be commited, can just be listed in your [`.gitignore`](https://git-scm.com/docs/gitignore). If any .gitignore'd files are imported by other files, be sure to check they exist, so you don't get errors when cloning onto a fresh system. +Something that is important to keep in mind, is security. Often you may have some personal info included in some of your dotfiles. Before storing anything on the internet, double check there's no sensitive info (think SSH keys, API keys or plaintext passwords). There's several solutions for managing sensitve info. -Another solution, is to encrypt sensitive info. A great tool for this is [`pass`](https://www.passwordstore.org/) as it makes GPG-encrypting passwords very easy ([this article](https://www.outcoldman.com/en/archive/2015/09/17/keep-sensitive-data-encrypted-in-dotfiles/) outlines how), or you could also just use plain old GPG (as outlined in [this article](https://www.abdullah.today/encrypted-dotfiles/)). +The simplest is just to have a [`.gitignore`](https://git-scm.com/docs/gitignore), so no private files get committed. Be sure to make sure your setup doesn't depend on those files though, or you'll get an error while setting up a fresh system. + +Another option, is to encrypt sensitive info. A great tool for this is [`pass`](https://www.passwordstore.org/) as it makes GPG-encrypting passwords very easy ([this article](https://www.outcoldman.com/en/archive/2015/09/17/keep-sensitive-data-encrypted-in-dotfiles/) outlines how), or you could also just use plain old GPG (as outlined in [this article](https://www.abdullah.today/encrypted-dotfiles/)). + +I went with [git-crypt](https://github.com/AGWA/git-crypt), a GPG-based solution designed specifically for git repos. There's fallback (safe) plaintext versions, to prevent any errors if the GPG keys aren't present. --- @@ -143,7 +149,7 @@ To learn more, DistroTube made an excellent [video about bare git repos](https:/ #### Dotfile Dependencies -In terms of managing dependencies, using either [git submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) or [git subtree](https://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt) will let you keep dependencies in your project, while also separate from your own code and easily updatable. +In terms of managing dependencies, using either [git submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) or [git subtree](https://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt) will let you keep dependencies in your project, while also separate from your own code and easily updatable. But again, you could do this yourself with a simple script. --- @@ -156,7 +162,7 @@ By all means feel free to take what you want from mine. I've taken care to ensur If you're looking for some more example dotfile repos to get you started, I can highly recommend taking a look at: [@holman/dotfiles](https://github.com/holman/dotfiles), [@nickjj/dotfiles](https://github.com/nickjj/dotfiles), [@caarlos0/dotfiles](https://github.com/caarlos0/dotfiles), [@cowboy/dotfiles](https://github.com/cowboy/dotfiles), [@drduh/config](https://github.com/drduh/config). -There's even more to check out at [webpro/awesome-dotfiles](https://github.com/webpro/awesome-dotfiles), [dotfiles.github.io](https://dotfiles.github.io/) and [r/unixporn](https://www.reddit.com/r/unixporn/). +And for some more inspiration, check out [webpro/awesome-dotfiles](https://github.com/webpro/awesome-dotfiles), [dotfiles.github.io](https://dotfiles.github.io/) and [r/unixporn](https://www.reddit.com/r/unixporn/). ---