Dotfiles v2.0

This commit is contained in:
2024-03-21 16:02:35 +00:00
parent f727c95bce
commit e001c92190
121 changed files with 218 additions and 570 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
.DS_Store
*/*.DS_Store
.Trash
BrewFile.lock.json

99
BrewFile Normal file
View File

@@ -0,0 +1,99 @@
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-fonts"
tap "homebrew/services"
# Play, record, convert, and stream audio and video
brew "ffmpeg"
# Quickly generate a temporary email address
brew "mailsy"
# Create, run, and share large language models (LLMs)
brew "ollama", restart_service: true
# Safe, concurrent, practical language
brew "rust"
# Organize software neatly under a single directory tree (e.g. /usr/local)
brew "stow"
# Internet file retriever
brew "wget"
# Allows connection to a computer remotely
cask "anydesk"
# Reclaim tens of gigabytes of your storage used for various Xcode caches
cask "devcleaner"
# Utilities designed to make common development tasks easier
cask "devtoys"
# Matrix collaboration client
cask "element"
# Web browser
cask "firefox"
# Developer targeted fonts with a high number of glyphs
cask "font-jetbrains-mono-nerd-font"
# Menu bar application that displays the CPU speed limit due to thermal issues
cask "hot"
# Modpack for Minecraft 1.7.10 and 1.8.9
cask "lunar-client"
# Free and open-source RSS reader
cask "netnewswire"
# Knowledge base that works on top of a local folder of plain text Markdown files
cask "obsidian"
# Control your tools with a few keystrokes
cask "raycast"
# Tool that provides consistent, highly configurable symbols for apps
cask "sf-symbols"
# Instant messaging application focusing on security
cask "signal"
# Video game digital distribution service
cask "steam"
# Open-source media center
cask "stremio"
# Mesh VPN based on Wireguard
cask "tailscale"
# Open-source BitTorrent client
cask "transmission"
# Virtual machines UI using QEMU
cask "utm"
# Open-source code editor
cask "visual-studio-code"
# Wine wrapper built with SwiftUI
cask "whisky"
vscode "10nates.ollama-autocoder"
vscode "adpyke.codesnap"
vscode "bbenoist.nix"
vscode "christian-kohler.path-intellisense"
vscode "donjayamanne.githistory"
vscode "dustypomerleau.rust-syntax"
vscode "dzhavat.bracket-pair-toggler"
vscode "ecmel.vscode-html-css"
vscode "esbenp.prettier-vscode"
vscode "formulahendry.code-runner"
vscode "foxundermoon.shell-format"
vscode "grapecity.gc-excelviewer"
vscode "gruntfuggly.todo-tree"
vscode "hars.cppsnippets"
vscode "kevinrose.vsc-python-indent"
vscode "kisstkondoros.vscode-gutter-preview"
vscode "mcu-debug.debug-tracker-vscode"
vscode "ms-python.black-formatter"
vscode "ms-python.debugpy"
vscode "ms-python.python"
vscode "ms-python.vscode-pylance"
vscode "ms-toolsai.jupyter"
vscode "ms-toolsai.jupyter-keymap"
vscode "ms-toolsai.jupyter-renderers"
vscode "ms-vscode.cpptools"
vscode "ms-vscode.cpptools-extension-pack"
vscode "ms-vsliveshare.vsliveshare"
vscode "njpwerner.autodocstring"
vscode "oderwat.indent-rainbow"
vscode "pkief.material-icon-theme"
vscode "redhat.vscode-yaml"
vscode "ritwickdey.liveserver"
vscode "rust-lang.rust-analyzer"
vscode "serayuzgur.crates"
vscode "simonsiefke.svg-preview"
vscode "sswg.swift-lang"
vscode "streetsidesoftware.code-spell-checker"
vscode "streetsidesoftware.code-spell-checker-portuguese"
vscode "vadimcn.vscode-lldb"
vscode "visualstudioexptteam.intellicode-api-usage-examples"
vscode "visualstudioexptteam.vscodeintellicode"
vscode "vscodevim.vim"
vscode "wix.vscode-import-cost"

View File

@@ -1,12 +0,0 @@
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
source ~/dotfiles/scripts/p.sh
alias ls='ls --color=auto'
alias grep='grep --color=auto'
PS1='\n[\[\e[37m\]\u\[\e[0m\]@\[\e[37;2m\]\h\[\e[0m\]] \[\e[1m\]\w \[\e[0;2m\]J:\[\e[0m\]\j\n\$ '

View File

@@ -1,4 +0,0 @@
source ~/dotfiles/scripts/p.sh
alias ls='ls --color=auto'
alias grep='grep --color=auto'

View File

@@ -1,198 +0,0 @@
#! /bin/bash
source ./scripts/p.sh
source ./scripts/color.sh
dist=$(d)
if [ $dist == 0 ]; then
echo -e "${RED}[E] Distro not supported.${ENDCOLOR}"
return 1
fi
# Ask Y/n
function ask() {
read -p "$1 (Y/n): " resp
if [ -z "$resp" ]; then
response_lc="y" # empty is Yes
else
response_lc=$(echo "$resp" | tr '[:upper:]' '[:lower:]') # case insensitive
fi
[ "$response_lc" = "y" ]
}
# Upgrade
echo -e "${GREEN}[+] Updating packages...${ENDCOLOR}"
p
# Install git
if p c git &>/dev/null; then
echo -e "${GREEN}[i] git is installed.${ENDCOLOR}"
else
echo -e "${GREEN}[+] Installing git...${ENDCOLOR}"
p i git
echo -e "${GREEN}[i] git installed.${ENDCOLOR}"
fi
# Mirrors
if [ $dist == 2 ]; then
if ask "Choose best mirrors (LONG TIME)?"; then
echo -e "${GREEN}[+] Choosing mirrors...${ENDCOLOR}"
p i reflector
sudo reflector --sort rate -p https --save /etc/pacman.d/mirrorlist --verbose
echo -e "${GREEN}[i] New mirrors applied.${ENDCOLOR}"
else
echo -e "${RED}[i] Cancelled.${ENDCOLOR}"
fi
fi
# Install paru
if [ $dist == 2 ]; then
if p c paru &>/dev/null; then
echo -e "${GREEN}[i] Paru is installed.${ENDCOLOR}"
else
echo -e "${GREEN}[+] Installing paru...${ENDCOLOR}"
sudo pacman -S --needed base-devel
git clone https://aur.archlinux.org/paru.git
cd paru
makepkg -si
cd ..
rm -rf paru
echo -e "${GREEN}[i] Paru installed.${ENDCOLOR}"
fi
fi
# Enable bluetooth support
if [ $dist == 2 ]; then
if p c bluetooth &>/dev/null; then
echo -e "${GREEN}[i] Bluetooth is enabled.${ENDCOLOR}"
else
if ask "Enable bluetooth?"; then
echo -e "${GREEN}[+] Installing bluetooth support...${ENDCOLOR}"
sudo pacman -S bluez bluez-utils
sudo systemctl start bluetooth.service
sudo systemctl enable bluetooth.service
echo -e "${GREEN}[i] Bluetooth enabled.${ENDCOLOR}"
else
echo -e "${RED}[i] Cancelled.${ENDCOLOR}"
fi
fi
fi
# Enable printer support
if [ $dist == 2 ]; then
if p c cups &>/dev/null; then
echo -e "${GREEN}[i] CUPS is enabled.${ENDCOLOR}"
else
if ask "Enable CUPS (printer)?"; then
echo -e "${GREEN}[+] Installing CUPS...${ENDCOLOR}"
sudo pacman -S cups
sudo systemctl start cups
sudo systemctl start cups.service
sudo systemctl enable cups
sudo systemctl enable cups.service
echo -e "${GREEN}[i] CUPS enabled.${ENDCOLOR}"
else
echo -e "${RED}[i] Cancelled.${ENDCOLOR}"
fi
fi
fi
# Install Icon theme
if [ $dist != 3 ]; then
if ls /usr/share/icons/ | grep -i Papirus &>/dev/null; then
echo -e "${GREEN}[i] Icon theme is installed.${ENDCOLOR}"
else
echo -e "${GREEN}[+] Downloading Papirus icon theme...${ENDCOLOR}"
wget -qO- https://git.io/papirus-icon-theme-install | sh
wget -qO- https://git.io/papirus-folders-install | sh
papirus-folders -C adwaita
gsettings set org.gnome.desktop.interface icon-theme 'Papirus-Dark'
echo -e "${GREEN}[i] Theme is set.${ENDCOLOR}"
fi
fi
# Install Cursor theme
if [ $dist != 3 ]; then
if ls /usr/share/icons/ | grep -i bibata &>/dev/null; then
echo -e "${GREEN}[i] Cursor theme is installed.${ENDCOLOR}"
else
echo -e "${GREEN}[+] Downloading Bibata cursor theme...${ENDCOLOR}"
p i bibata-cursor-theme
gsettings set org.gnome.desktop.interface cursor-theme 'Bibata-Modern-Classic'
echo -e "${GREEN}[i] Cursor theme set.${ENDCOLOR}"
fi
fi
# Install Nerd Font
if [ $dist == 2 ]; then
if p c ttf-jetbrains-mono-nerd &>/dev/null; then
echo -e "${GREEN}[i] JetBrains font is installed.${ENDCOLOR}"
else
echo -e "${GREEN}[+] Installing JetBrains font.${ENDCOLOR}"
p i ttf-jetbrains-mono-nerd
echo -e "${GREEN}[i] JetBrains font installed.${ENDCOLOR}"
fi
else
if p c fonts-jetbrains-mono &>/dev/null; then
echo -e "${GREEN}[i] JetBrains font is installed.${ENDCOLOR}"
else
echo -e "${GREEN}[+] Installing JetBrains font.${ENDCOLOR}"
p i fonts-jetbrains-mono
echo -e "${GREEN}[i] JetBrains font installed.${ENDCOLOR}"
fi
fi
# Enable minimize button
if [ $dist != 3 ]; then
echo -e "${GREEN}[+] Adding the minimize button...${ENDCOLOR}"
gsettings set org.gnome.desktop.wm.preferences button-layout ":minimize,close"
fi
# Enable flatpak support
if [ $dist != 3 ]; then
if p c flatpak &>/dev/null; then
echo -e "${GREEN}[i] Flatpaks are supported.${ENDCOLOR}"
else
if ask "Enable flatpak?"; then
echo -e "${GREEN}[+] Adding flatpak support...${ENDCOLOR}"
p i flatpak
flatpak install flatseal
sudo flatpak override --filesystem=$HOME/.themes
sudo flatpak override --filesystem=$HOME/.icons
echo -e "${GREEN}[+] Flatpak support added.${ENDCOLOR}"
else
echo -e "${RED}[i] Cancelled.${ENDCOLOR}"
fi
fi
fi
# Install Timeshift
if [ $dist != 3 ]; then
if p c timeshift &>/dev/null; then
echo -e "${GREEN}[i] Timeshift is installed.${ENDCOLOR}"
else
if ask "Install Timeshift?"; then
echo -e "${GREEN}[+] Installing Timeshift...${ENDCOLOR}"
p i timeshift
sudo systemctl enable cronie
sudo systemctl start cronie
echo -e "${GREEN}[i] Timeshift installed.${ENDCOLOR}"
else
echo -e "${RED}[i] Cancelled.${ENDCOLOR}"
fi
fi
fi
# Copy configs
echo -e "${GREEN}[+] Configuring system...${ENDCOLOR}"
cp -rf ./homeConfigs/.* ~
# Enable bash case insensitive completion
cat /etc/inputrc | grep completion-ignore-case
if [ $? == 1 ]; then
echo 'set completion-ignore-case On' | sudo tee -a /etc/inputrc
fi
echo -e "${GREEN}${BOLD}[i] All done.${ENDCOLOR}"

View File

@@ -1,12 +0,0 @@
#! /bin/bash
source ./p.sh
if p c ollama &>/dev/null; then
kgx -e "ollama serve"
sleep 1
kgx -e "ollama run codellama"
else
p i ollama
echo
echo 'Run the script again...'
fi

View File

@@ -1,34 +0,0 @@
#! /bin/bash
source ~/dotfiles/scripts/p.sh
source ~/dotfiles/scripts/color.sh
echo -e "${GREEN}[+] Upgrading...${ENDCOLOR}"
p
echo -e "${GREEN}[+] Cleaning orphaned (unneeded) packages...${ENDCOLOR}"
sudo paru -Rsn $(paru -Qdtq)
echo -e "${GREEN}[+] Cleaning old pacman cache...${ENDCOLOR}"
if p c pacman-contrib &>/dev/null; then
paccache -rk1
else
p i pacman-contrib
paccache -rk1
fi
echo -e "${GREEN}[+] Removing logs older than 7d...${ENDCOLOR}"
sudo journalctl --vacuum-time=7d
if p c flatpak &>/dev/null; then
echo -e "${GREEN}[+] Cleaning flatpak...:${ENDCOLOR}"
flatpak remove --unused
fi
echo -e "${GREEN}[i] AUR Packages installed:${ENDCOLOR}"
pacman -Qim | awk '/^Name/{name=$3} /^Installed Size/{print $4$5, name}' | sort -h
# Installed packages: pacman -Qen
echo
read -p "Press enter to exit."

View File

@@ -1,5 +0,0 @@
#! /bin/bash
sudo pacman -Syu
sudo pacman -S wine wine-mono wine-gecko
sudo pacman -S --asdeps --needed $(pacman -Si wine | sed -n '/^Opt/,/^Conf/p' | sed '$d' | sed 's/^Opt.*://g' | sed 's/^\s*//g' | tr '\n' ' ')

View File

@@ -1,18 +0,0 @@
#! /bin/bash
RED="\e[31m"
GREEN="\e[32m"
YELLOW="\e[33m"
BLUE="\e[34m"
MAGENTA="\e[35m"
CYAN="\e[36m"
GRAY="\e[90m"
ENDCOLOR="\e[0m"
ENDCOLOR="\e[0m"
BOLD="\e[1m"
FAINT="\e[2m"
ITALIC="\e[3m"
UNDERLINE="\e[4m"
# Example usage: echo -e "${GRAY}Gray text${ENDCOLOR}"

View File

@@ -1,21 +0,0 @@
#! /bin/bash
source ~/dotfiles/scripts/color.sh
source ~/dotfiles/scripts/p.sh
echo -e "${GREEN}[+] Upgrading...${ENDCOLOR}"
sudo apt update
sudo apt upgrade
sudo apt dist-upgrade
sudo apt autoremove
sudo apt autoclean
echo -e "${GREEN}[+] Removing logs older than 7d...${ENDCOLOR}"
sudo journalctl --vacuum-time=7d
if p c flatpak &>/dev/null; then
echo -e "${GREEN}[+] Cleaning flatpak...:${ENDCOLOR}"
flatpak remove --unused
fi
read -p "Press enter to exit."

View File

@@ -1,7 +0,0 @@
#! /bin/bash
sudo
echo "------------------- TCP --------------------"
sudo ss -tlpn
echo "------------------- UDP --------------------"
sudo ss -ulpn

View File

@@ -1,181 +0,0 @@
#! /bin/bash
# Cross-distro package manager wrapper
source ~/dotfiles/scripts/color.sh
d() {
if [ "$(uname -s)" = "Darwin" ]; then
echo 3
else
if [ "$(grep -Ei 'debian|buntu|mint' /etc/*release)" ]; then
echo 1
elif [ "$(grep -Ei 'arch|manjaro|artix' /etc/*release)" ]; then
echo 2
else
echo 0
fi
fi
}
m() {
d=$(d)
if [ $d -eq 2 ]; then
~/dotfiles/scripts/arch-maintenance.sh
elif [ $d -eq 1 ]; then
~/dotfiles/scripts/debian-maintenance.sh
elif [ $d -eq 3 ]; then
~/dotfiles/scripts/macos-maintenance.sh
else
echo -e "${RED}[E] Distro not supported.${ENDCOLOR}"
return 1
fi
}
p() {
# Detect distro type
d=$(d)
if [ $d -eq 1 ]; then
distro="DEB"
update="sudo apt update; sudo apt upgrade; sudo apt autoremove"
install="sudo apt install"
remove="sudo apt remove"
elif [ $d -eq 2 ]; then
if pacman -Qs paru >/dev/null; then
update="paru -Syu"
install="paru -S"
remove="paru -R"
else
update="sudo pacman -Syu"
install="sudo pacman -S"
remove="sudo pacman -R"
fi
distro="ARCH"
elif [ $d -eq 3 ]; then
distro="MAC"
update="brew update; brew upgrade"
install="brew install"
remove="brew uninstall"
else
echo "[E] Distro not supported."
return 1
fi
# Detect if flatpak is installed.
if flatpak --version &>/dev/null; then
flatpak=true
else
flatpak=false
fi
# If no parameter
if [ -z $1 ] || [ $1 = "u" ]; then
echo -e "${GREEN}[+] Updating packages...${ENDCOLOR}"
bash -c $update
if $flatpak; then
echo
echo -e "${GREEN}[+] Updating flatpaks...${ENDCOLOR}"
flatpak upgrade
fi
echo -e "${GREEN}[i] done.${ENDCOLOR}"
return 0
elif [ $1 = "i" ]; then # If first parameter is i (install)
echo -e "${GREEN}[+] Searching for $2 on the repository...${ENDCOLOR}"
bash -c "$install $2"
if [ $? -eq 0 ]; then
echo -e "${GREEN}[i] $2 installed.${ENDCOLOR}"
return 0
else
if $flatpak; then
echo
echo -e "${YELLOW}[E] $2 not found.${ENDCOLOR}"
echo -e "${GREEN}[+] Searching for $2 as a flatpak...${ENDCOLOR}"
echo
flatpak install $2 2>/dev/null
if [ $? -eq 0 ]; then
echo -e "${GREEN}[i] $2 installed.${ENDCOLOR}"
return 0
fi
fi
echo -e "${RED}[E] $2 not found or already installed.${ENDCOLOR}"
return 2
fi
elif [ $1 = "r" ]; then # If first parameter is r (remove)
echo -e "${YELLOW}[+] Removing $2...${ENDCOLOR}"
bash -c "$remove $2"
if [ $? -eq 0 ]; then
echo -e "${GREEN}[i] $2 removed.${ENDCOLOR}"
return 0
else
if $flatpak; then
echo
echo -e "${YELLOW}[E] $2 not found.${ENDCOLOR}"
echo "[+] Searching for $2 as a flatpak..."
echo -e "${GREEN}[+] Searching for $2 as a flatpak...${ENDCOLOR}"
echo
flatpak remove $2 2>/dev/null
if [ $? -eq 0 ]; then
echo -e "${GREEN}[i] $2 removed.${ENDCOLOR}"
return 0
fi
fi
echo -e "${RED}[E] $2 not found.${ENDCOLOR}"
return 2
fi
elif [ $1 = "c" ]; then # If first parameter is c (check)
if [ "$distro" = "DEB" ]; then
if dpkg-query -W -f='${Status}' $2 2>/dev/null | grep -q "install ok installed"; then
echo true
return 0
else
if $flatpak; then
flatpak list | grep $2 &>/dev/null
if [ $? -eq 0 ]; then
echo true
return 0
fi
fi
echo false
return 1
fi
elif [ "$distro" = "ARCH" ]; then
if pacman -Qs $2 >/dev/null; then
echo true
return 0
else
if $flatpak; then
flatpak list | grep -i $2 &>/dev/null
if [ $? -eq 0 ]; then
echo true
return 0
fi
fi
echo false
return 1
fi
elif [ "$distro" = "MAC" ]; then
if brew list | grep $2 >/dev/null; then
echo true
return 0
else
echo false
return 1
fi
else
echo 2
fi
else
echo -e "${YELLOW}${UNDERLINE}[i] Usage:${ENDCOLOR}"
echo -e "p (u) ${FAINT}- update os${ENDCOLOR}"
echo -e "p i package ${FAINT}- install package${ENDCOLOR}"
echo -e "p r package ${FAINT}- remove package${ENDCOLOR}"
echo -e "p c package ${FAINT}- check if package is installed (true/false; 2 -> ERROR)${ENDCOLOR}"
echo -e "d ${FAINT}- returns 1 -> Debian; 2 -> Arch; 0 -> Error${ENDCOLOR}"
echo -e "m ${FAINT}- maintenance script${ENDCOLOR}"
echo
echo -e "${YELLOW}${UNDERLINE}[i] Order of operations:${ENDCOLOR}"
echo "1 - Check distro repos"
echo "2 - Check AUR if on Arch"
echo "3 - Check flatpaks (only if flatpak support is enabled)"
fi
}

View File

@@ -1,61 +0,0 @@
## MacOS Commands (built-in)
**Password-protected Zip:**
```sh
zip -e protected.zip /file/to/protect/
```
**Remove dotfiles:**
```sh
dot_clean .
```
**Show all files in finder:**
```sh
defaults write com.apple.Finder AppleShowAllFiles 1
```
**Search using Spotlight:**
```sh
mdfind "file name”
```
**Rebuild Spotlight index:**
```sh
mdutil -E
```
**Turn off Spotlight indexing:**
```sh
dutil -i off
```
**Repair Disk permissions:**
```sh
sudo /usr/libexec/repair_packages --repair --standard-pkgs --volume /
```
**Generate SHA-1 digest of a file:**
```sh
/usr/bin/openssl sha1 download.dmg
```
**Disable sleep temporarily:**
```sh
caffeinate
```
**Open multiple instances of a program:**
```sh
open multiple instances open -n /Applications/Safari.app/
```
**Check network speed:**
```sh
networkQuality
```
**Convert files (txt, html, rtf, rtfd, doc, docx):**
```sh
textutil -convert html journal.doc
```

Some files were not shown because too many files have changed in this diff Show More