diff --git a/.brew_programs b/.brew_programs index f5c645c..10fa4d2 100644 --- a/.brew_programs +++ b/.brew_programs @@ -22,6 +22,7 @@ telnet texinfo tmux tree +watch wget zoxide zsh diff --git a/.brew_programs_cask b/.brew_programs_cask index fe18403..5802d32 100644 --- a/.brew_programs_cask +++ b/.brew_programs_cask @@ -1,6 +1,5 @@ -akiflow alacritty -alfred +brave chatterino dbeaver-community discord @@ -9,7 +8,6 @@ docker firefox@nightly font-hack-nerd-font gimp -google-chrome hiddenbar karabiner-elements keepassxc @@ -33,6 +31,6 @@ transfer twingate visual-studio-code vlc +whatsapp winbox -wine-crossover wireshark diff --git a/.local/bin/Update-pkg b/.local/bin/Update-pkg index af6fea3..17af297 100755 --- a/.local/bin/Update-pkg +++ b/.local/bin/Update-pkg @@ -1,4 +1,4 @@ -#!/bin/bash +#!/opt/homebrew/opt/bash/bin/bash # shellcheck disable=2010,2045,2086,2155 # Path to the zsh folder @@ -17,18 +17,18 @@ NC='\033[0m' TERRAFORM_VERSION="1.5.7" # Python -if which python3 > /dev/null 2>&1; then - python="python3" - pip="pip3" +if which python3 >/dev/null 2>&1; then + python="python3" + pip="pip3" else - export PYTHONVERSION=$(ls -la /opt/homebrew/opt/ | - grep -iEo 'python@.* ->' | - sed 's/ ->//g' | - sort | - tail -n1 | - sed 's/python@//g') - python="/opt/homebrew/bin/python$PYTHONVERSION" - pip="/opt/homebrew/bin/pip$PYTHONVERSION" + export PYTHONVERSION=$(ls -la /opt/homebrew/opt/ | + grep -iEo 'python@.* ->' | + sed 's/ ->//g' | + sort | + tail -n1 | + sed 's/python@//g') + python="/opt/homebrew/bin/python$PYTHONVERSION" + pip="/opt/homebrew/bin/pip$PYTHONVERSION" fi PIPEXT="--user --force --quiet --no-warn-script-location" @@ -42,585 +42,594 @@ GENTOO="/etc/gentoo-release" install="" if [[ "$(uname)" == "Darwin" ]]; then - install="brew install" + install="brew install" elif [[ -f $GENTOO ]]; then - install="sudo emerge --update" + install="sudo emerge --update" elif [[ -f /etc/debian_version ]]; then - sudo apt update - install="sudo apt install -y" + sudo apt update + install="sudo apt install -y" elif [[ -f /etc/redhat-release ]]; then - install="sudo dnf install" + install="sudo dnf install" fi function timestamp() { - echo -e "${GREEN}[+]${NC} $(date +'%F %T') [INFO] $*" + echo -e "${GREEN}[+]${NC} $(date +'%F %T') [INFO] $*" } function err() { - echo -e "${RED}[-] $(date +'%F %T') [ERROR] $*${NC}" >&2 + echo -e "${RED}[-] $(date +'%F %T') [ERROR] $*${NC}" >&2 } function command_start() { - timestamp "Command $* has been started." - if ! "$*"; then - err "---------" - err "Command $* went wrong." - err "---------" - # exit - fi - timestamp "Command $* has been ended." + timestamp "Command $* has been started." + if ! "$@"; then + err "---------" + err "Command $* went wrong." + err "---------" + # exit + fi + timestamp "Command $* has been ended." } function command_exists() { - if command -v "$1" > /dev/null 2>&1; then - timestamp "Command $1 has been found" - else - err "Command $1 has been NOT found" + if command -v "$1" >/dev/null 2>&1; then + timestamp "Command $1 has been found" + else + err "Command $1 has been NOT found" - # Return false - return 1 - fi + # Return false + return 1 + fi } function update_pip() { - # Update the pip - if [[ "$(uname)" == "Darwin" ]]; then - $python -m pip install --upgrade pip --user --no-warn-script-location - elif [[ -f $GENTOO ]]; then - $install dev-python/pip - fi + # Update the pip + if [[ "$(uname)" == "Darwin" ]]; then + $python -m pip install --upgrade pip --user --no-warn-script-location + elif [[ -f $GENTOO ]]; then + $install dev-python/pip + fi } function install_neovim_module_for_python() { - # Python module in neovim - $pip install pynvim neovim imps $PIPEXTPRE + # Python module in neovim + $pip install pynvim neovim imps $PIPEXTPRE } function install_node() { - if command_exists npm; then - timestamp "Node has been found" - else - if [[ "$(uname)" == "Darwin" ]]; then - brew uninstall node --ignore-dependencies - sudo rm -rf /opt/homebrew/lib/node_modules/npm/ - $install node - elif [[ -f $GENTOO ]]; then - $install dev-lang/nodejs - fi - fi + if command_exists npm; then + timestamp "Node has been found" + else + if [[ "$(uname)" == "Darwin" ]]; then + brew uninstall node --ignore-dependencies + sudo rm -rf /opt/homebrew/lib/node_modules/npm/ + $install node + elif [[ -f $GENTOO ]]; then + $install dev-lang/nodejs + fi + fi } function install_pyright() { - # Install pyright - sudo npm -s -g i pyright --force + # Install pyright + sudo npm -s -g i pyright --force } function install_mdformat() { - # Install mdformat - $pip install mdformat $PIPEXTPRE + # Install mdformat + $pip install mdformat $PIPEXTPRE } function install_ruff() { - # Install ruff - $pip install ruff $PIPEXTPRE + # Install ruff + $pip install ruff $PIPEXTPRE } function install_bash-language-server() { - # Install bash-language-server - sudo npm -s -g i bash-language-server --force + # Install bash-language-server + sudo npm -s -g i bash-language-server --force } function install_yaml-language-server() { - # Install yaml-language-server - sudo npm -s -g i yaml-language-server --force + # Install yaml-language-server + sudo npm -s -g i yaml-language-server --force } function install_shfmt() { - # Install shfmt - GO111MODULE=on go install mvdan.cc/sh/v3/cmd/shfmt@latest + # Install shfmt + GO111MODULE=on go install mvdan.cc/sh/v3/cmd/shfmt@latest } function install_lazy() { - # Install shfmt - GO111MODULE=on go install github.com/jesseduffield/lazygit@latest - GO111MODULE=on go install github.com/jesseduffield/lazydocker@latest + # Install shfmt + GO111MODULE=on go install github.com/jesseduffield/lazygit@latest + GO111MODULE=on go install github.com/jesseduffield/lazydocker@latest } function install_dlv() { - GO111MODULE=on go install github.com/go-delve/delve/cmd/dlv@latest + GO111MODULE=on go install github.com/go-delve/delve/cmd/dlv@latest } function install_terraform_stable() { - # Install terraform and terraform-ls - GO111MODULE=on go install github.com/hashicorp/terraform-ls@latest + # Install terraform and terraform-ls + GO111MODULE=on go install github.com/hashicorp/terraform-ls@latest - if [[ "$(uname)" == "Darwin" ]]; then - $install tflint -q - $install tfenv -q - TFENV_ARCH=amd64 tfenv install "$TERRAFORM_VERSION" - tfenv use "$TERRAFORM_VERSION" - else - GO111MODULE=on go install github.com/hashicorp/terraform@v"$TERRAFORM_VERSION" - curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash - fi + if [[ "$(uname)" == "Darwin" ]]; then + $install tflint -q + $install tfenv -q + TFENV_ARCH=amd64 tfenv install "$TERRAFORM_VERSION" + tfenv use "$TERRAFORM_VERSION" + else + GO111MODULE=on go install github.com/hashicorp/terraform@v"$TERRAFORM_VERSION" + curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash + fi } function install_terraform() { - # Install terraform and terraform-ls - GO111MODULE=on go install github.com/hashicorp/terraform-ls@latest - if [[ "$(uname)" == "Darwin" ]]; then - $install tflint -q - $install tfenv -q - TFENV_ARCH=amd64 tfenv install latest - mapfile -t TFENV_VER_ARRAY < <(tfenv list | grep -ioE ' [0-9.]+' | sed -e '1,1d') - if [ "${#TFENV_VER_ARRAY[@]}" -gt "2" ]; then - for i in "${TFENV_VER_ARRAY[@]}"; do - tfenv uninstall "$i" && timestamp "Removed - terraform '$i' version" - done - fi - else - GO111MODULE=on go install github.com/hashicorp/terraform@latest - curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash - fi + # Install terraform and terraform-ls + GO111MODULE=on go install github.com/hashicorp/terraform-ls@latest + if [[ "$(uname)" == "Darwin" ]]; then + $install tflint -q + $install tfenv -q + TFENV_ARCH=amd64 tfenv install latest + mapfile -t TFENV_VER_ARRAY < <(tfenv list | grep -ioE ' [0-9.]+' | sed -e '1,1d') + if [ "${#TFENV_VER_ARRAY[@]}" -gt "2" ]; then + for i in "${TFENV_VER_ARRAY[@]}"; do + tfenv uninstall "$i" && timestamp "Removed - terraform '$i' version" + done + fi + else + GO111MODULE=on go install github.com/hashicorp/terraform@latest + curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash + fi } function install_terragrunt() { - # Install terragrunt - if [[ "$(uname)" == "Darwin" ]]; then - $install terragrunt -q - else - TERRAGRUNT=$HOME/.local/bin/terragrunt - REMOTE_VERSION=$(curl -s https://api.github.com/repos/gruntwork-io/terragrunt/releases/latest | grep -iEo '"tag_name":.*' | sed 's/"tag_name"://g;s/"//g;s/,//g;s/ //g') + # Install terragrunt + if [[ "$(uname)" == "Darwin" ]]; then + $install terragrunt -q + else + TERRAGRUNT=$HOME/.local/bin/terragrunt + REMOTE_VERSION=$(curl -s https://api.github.com/repos/gruntwork-io/terragrunt/releases/latest | grep -iEo '"tag_name":.*' | sed 's/"tag_name"://g;s/"//g;s/,//g;s/ //g') - CURRENT_VERSION="0.0.0" - [ -f $TERRAGRUNT ] && CURRENT_VERSION=$($TERRAGRUNT version) + CURRENT_VERSION="0.0.0" + [ -f $TERRAGRUNT ] && CURRENT_VERSION=$($TERRAGRUNT version) - if [ "$REMOTE_VERSION" == "$CURRENT_VERSION" ]; then - timestamp "The current version of the TSS-SDK is the same as the newest version" - return 0 - else - brew install wget - wget https://github.com/gruntwork-io/terragrunt/releases/latest/download/terragrunt_linux_amd64 -O $TERRAGRUNT - chmod +x "$TERRAGRUNT" - fi - fi + if [ "$REMOTE_VERSION" == "$CURRENT_VERSION" ]; then + timestamp "The current version of the TSS-SDK is the same as the newest version" + return 0 + else + brew install wget + wget https://github.com/gruntwork-io/terragrunt/releases/latest/download/terragrunt_linux_amd64 -O $TERRAGRUNT + chmod +x "$TERRAGRUNT" + fi + fi } function install_shellcheck() { - # Install shellcheck - if [[ "$(uname)" == "Darwin" ]]; then - $install shellcheck -q - else - curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash - fi + # Install shellcheck + if [[ "$(uname)" == "Darwin" ]]; then + $install shellcheck -q + else + curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash + fi } function install_marksman() { - # Install marksman - if [[ "$(uname)" == "Darwin" ]]; then - $install marksman -q - else - wget https://github.com/artempyanykh/marksman/releases/latest/download/marksman-linux-x64 -O $HOME/.local/bin/marksman - chmod +x $HOME/.local/bin/marksman - fi + # Install marksman + if [[ "$(uname)" == "Darwin" ]]; then + $install marksman -q + else + wget https://github.com/artempyanykh/marksman/releases/latest/download/marksman-linux-x64 -O $HOME/.local/bin/marksman + chmod +x $HOME/.local/bin/marksman + fi } function install_go() { - # Install the golang - if [[ "$(uname)" == "Darwin" ]]; then - $install golang -q - elif [[ -f $GENTOO ]]; then - $install dev-lang/go - fi + # Install the golang + if [[ "$(uname)" == "Darwin" ]]; then + $install golang -q + elif [[ -f $GENTOO ]]; then + $install dev-lang/go + fi } function install_gopls() { - # Install gopls - GO111MODULE=on go install golang.org/x/tools/gopls@latest + # Install gopls + GO111MODULE=on go install golang.org/x/tools/gopls@latest } function install_ansible() { - # Install Ansible - $pip install ansible ansible-lint ansible-core $PIPEXTPRE - $pip install ansible-parallel $PIPEXTPRE + # Install Ansible + $pip install ansible ansible-lint ansible-core $PIPEXTPRE + $pip install ansible-parallel $PIPEXTPRE } function install_ansible-language-server() { - # Install ansible-language-server - sudo npm -s -g i @ansible/ansible-language-server --force - sudo npm -s -g i yaml-language-server --force + # Install ansible-language-server + sudo npm -s -g i @ansible/ansible-language-server --force + sudo npm -s -g i yaml-language-server --force } function install_meraki_ansible() { - # Install python, ansible module for meraki - ansible-galaxy collection install cisco.meraki --force - $pip install meraki $PIPEXT + # Install python, ansible module for meraki + ansible-galaxy collection install cisco.meraki --force + $pip install meraki $PIPEXT } function install_azure_cli() { - # Install azure_cli - $install azure-cli + # Install azure_cli + $install azure-cli } function install_awscli() { - # Install awscli - $install awscli + # Install awscli + $install awscli } function install_aws_adfs() { - # Install aws-adfs - $pip install aws-adfs $PIPEXTPRE + # Install aws-adfs + $pip install aws-adfs $PIPEXTPRE } function install_ytdlp() { - # Install yt-dlp - $pip install yt-dlp $PIPEXTPRE + # Install yt-dlp + $pip install yt-dlp $PIPEXTPRE } function install_spotifydl() { - # Install spotify_dl - $pip install spotdl $PIPEXTPRE + # Install spotify_dl + $pip install spotdl $PIPEXTPRE } function install_fzf() { - # Install fzf - FOLDER="$CONFIG/fzf" - mkdir -p $FOLDER + # Install fzf + FOLDER="$CONFIG/fzf" + mkdir -p $FOLDER - if [ -d $FOLDER ]; then - cd $CONFIG || err "Folder $CONFIG has been NOT found" - git clone https://github.com/junegunn/fzf.git $FOLDER && timestamp "Cloning the FZF" - cd $FOLDER || err "Folder $FOLDER has been NOT found" - git pull -q && timestamp "Pulled the $FOLDER configuration" - make install - fi + if [ -d $FOLDER ]; then + cd $CONFIG || err "Folder $CONFIG has been NOT found" + git clone https://github.com/junegunn/fzf.git $FOLDER && timestamp "Cloning the FZF" + cd $FOLDER || err "Folder $FOLDER has been NOT found" + git pull -q && timestamp "Pulled the $FOLDER configuration" + make install + fi } function install_zsh_addons() { - if [ ! -d $ZSHFOLDER/aws ]; then - mkdir -p "$ZSHFOLDER/azure-cli" "$ZSHFOLDER/aws" + if [ ! -d $ZSHFOLDER/aws ]; then + mkdir -p "$ZSHFOLDER/azure-cli" "$ZSHFOLDER/aws" - curl -s https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/plugins/aws/aws.plugin.zsh \ - -o "$ZSHFOLDER"/aws/aws.plugin.zsh && - timestamp "Downloaded the newest version of aws plugin for zsh" + curl -s https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/plugins/aws/aws.plugin.zsh \ + -o "$ZSHFOLDER"/aws/aws.plugin.zsh && + timestamp "Downloaded the newest version of aws plugin for zsh" - curl -s https://raw.githubusercontent.com/Azure/azure-cli/dev/az.completion \ - -o "$ZSHFOLDER"/azure-cli/az.completion && - timestamp "Downloaded the newest version of az plugin for zsh" + curl -s https://raw.githubusercontent.com/Azure/azure-cli/dev/az.completion \ + -o "$ZSHFOLDER"/azure-cli/az.completion && + timestamp "Downloaded the newest version of az plugin for zsh" - cd $ZSHFOLDER || err "Folder $ZSHFOLDER has been NOT found" - git clone https://github.com/popstas/zsh-command-time.git && - timestamp "Cloning the zsh-command-time" - git clone https://github.com/zsh-users/zsh-syntax-highlighting.git && - timestamp "Cloning the zsh-syntax-highlighting" - git clone https://github.com/zsh-users/zsh-autosuggestions.git && - timestamp "Cloning the zsh-autosuggestions" - fi + cd $ZSHFOLDER || err "Folder $ZSHFOLDER has been NOT found" + git clone https://github.com/popstas/zsh-command-time.git && + timestamp "Cloning the zsh-command-time" + git clone https://github.com/zsh-users/zsh-syntax-highlighting.git && + timestamp "Cloning the zsh-syntax-highlighting" + git clone https://github.com/zsh-users/zsh-autosuggestions.git && + timestamp "Cloning the zsh-autosuggestions" + fi - for i in $(ls $ZSHFOLDER); do - FOLDER="$ZSHFOLDER/$i" - if [ -d "$FOLDER/.git" ]; then - cd "$FOLDER" || err "Folder $FOLDER has been NOT found" - git pull -q && timestamp "Pulling the $FOLDER configuration" - fi - done + for i in $(ls $ZSHFOLDER); do + FOLDER="$ZSHFOLDER/$i" + if [ -d "$FOLDER/.git" ]; then + cd "$FOLDER" || err "Folder $FOLDER has been NOT found" + git pull -q && timestamp "Pulling the $FOLDER configuration" + fi + done - if [ ! -d $OHMYZSH ]; then - cd $OHMYZSH || err "Folder $OHMYZSH has been NOT found" - git pull -q && timestamp "Pulling the $OHMYZSH configuration" - fi + if [ ! -d $OHMYZSH ]; then + cd $OHMYZSH || err "Folder $OHMYZSH has been NOT found" + git pull -q && timestamp "Pulling the $OHMYZSH configuration" + fi - curl -s https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/plugins/aws/aws.plugin.zsh -o "$ZSHFOLDER"/aws/aws.plugin.zsh && timestamp "Downloaded the newest version of aws plugin for zsh" - curl -s https://raw.githubusercontent.com/Azure/azure-cli/dev/az.completion -o "$ZSHFOLDER"/azure-cli/az.completion && timestamp "Downloaded the newest version of az plugin for zsh" + curl -s https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/plugins/aws/aws.plugin.zsh -o "$ZSHFOLDER"/aws/aws.plugin.zsh && timestamp "Downloaded the newest version of aws plugin for zsh" + curl -s https://raw.githubusercontent.com/Azure/azure-cli/dev/az.completion -o "$ZSHFOLDER"/azure-cli/az.completion && timestamp "Downloaded the newest version of az plugin for zsh" } function install_speedtest() { - # Install speedtest-cli - $pip install speedtest-cli $PIPEXTPRE + # Install speedtest-cli + $pip install speedtest-cli $PIPEXTPRE } function install_gh_cli() { - # Install gh-cli - if [[ "$(uname)" == "Darwin" ]]; then - $install gh - elif [[ -f $GENTOO ]]; then - $install dev-util/github-cli - fi + # Install gh-cli + if [[ "$(uname)" == "Darwin" ]]; then + $install gh + elif [[ -f $GENTOO ]]; then + $install dev-util/github-cli + fi } function install_kubernetes() { - # Install kubectl - LINK="" - CURRENT_VERSION="" - REMOTE_VERSION=$(curl -L -s https://dl.k8s.io/release/stable.txt) - KUBECTL_LOCATION="/opt/homebrew/bin/kubectl" + # Install kubectl + LINK="" + CURRENT_VERSION="" + REMOTE_VERSION=$(curl -L -s https://dl.k8s.io/release/stable.txt) + KUBECTL_LOCATION="/opt/homebrew/bin/kubectl" - [ -f $KUBECTL_LOCATION ] && CURRENT_VERSION=$($KUBECTL_LOCATION version --client | grep --color=no -iEo 'Client Version: v[0-9\.]+' | grep -ioE --color=no 'v[0-9\.]+') + [ -f $KUBECTL_LOCATION ] && CURRENT_VERSION=$($KUBECTL_LOCATION version --client | grep --color=no -iEo 'Client Version: v[0-9\.]+' | grep -ioE --color=no 'v[0-9\.]+') - if [ "$REMOTE_VERSION" == "$CURRENT_VERSION" ]; then - timestamp "The current version of the kubectl is the same as the newest version" - return 0 - fi + if [ "$REMOTE_VERSION" == "$CURRENT_VERSION" ]; then + timestamp "The current version of the kubectl is the same as the newest version" + return 0 + fi - if [[ "$(uname)" == "Darwin" ]]; then - LINK="http://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl" - else - LINK="http://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" - fi + if [[ "$(uname)" == "Darwin" ]]; then + LINK="http://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl" + else + LINK="http://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" + fi - wget "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" -O $KUBECTL_LOCATION - chmod +x $KUBECTL_LOCATION + wget "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" -O $KUBECTL_LOCATION + chmod +x $KUBECTL_LOCATION } function install_rust() { - # Install rust - if command_exists rustc; then - rustup update - rustup component add rust-analyzer - else - curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh - fi + # Install rust + if command_exists rustc; then + rustup update + rustup component add rust-analyzer + else + curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh + fi } function install_tss_client() { - # Install tss - CURRENT_VERSION="1.5.7" + # Install tss + TSS_VERSION_STABLE="$1" + CURRENT_VERSION="1.5.7" - # Example link: https://downloads.ss.thycotic.com/secretserversdk/1.5.7/secretserver-sdk-1.5.7-linux-x64.zip - TSSDOCS="https://docs.delinea.com/online-help/secret-server/api-scripting/sdk-devops/sdk-downloads/index.htm" - LINK="" - REMOTE_VERSION="" + if [ -z "$TSS_VERSION_STABLE" ]; then + TSS_VERSION_STABLE="" + timestamp "TSS_VERSION_STABLE variable is empty, the latest version will be installed" + fi - if [ "$(uname)" == "Darwin" ]; then - LINK=$(curl -s -L $TSSDOCS | grep -iEo 'href=".*-osx-x64.zip"' | sed 's/href\=//g;s/"//g' | sort -r | head -n1) - REMOTE_VERSION=$(echo $LINK | grep -iEo '[0-9.]+-osx' | sed 's/-osx//g') - else - LINK=$(curl -s -L $TSSDOCS | grep -iEo 'href=".*-linux-x64.zip"' | sed 's/href\=//g;s/"//g' | sort -r | head -n1) - REMOTE_VERSION=$(echo $LINK | grep -iEo '[0-9.]+-linux' | sed 's/-linux//g') - fi + # Example link: https://downloads.ss.thycotic.com/secretserversdk/1.5.7/secretserver-sdk-1.5.7-linux-x64.zip + TSSDOCS="https://docs.delinea.com/online-help/secret-server/api-scripting/sdk-devops/sdk-downloads/index.htm" + LINK="" + REMOTE_VERSION="" - TSSFOLDER="$HOME/.local/tss-sdk" - TSSLINK="$HOME/.local/bin/tss" + if [ "$(uname)" == "Darwin" ]; then + if [ -n "$TSS_VERSION_STABLE" ]; then + LINK="https://downloads.ss.thycotic.com/secretserversdk/$TSS_VERSION_STABLE/secretserver-sdk-$TSS_VERSION_STABLE-osx-x64.zip" + REMOTE_VERSION=$TSS_VERSION + else + LINK=$(curl -s -L $TSSDOCS | grep -iEo 'href=".*-osx-x64.zip"' | sed 's/href\=//g;s/"//g' | sort -r | head -n1) + REMOTE_VERSION=$(echo $LINK | grep -iEo '[0-9.]+-osx' | sed 's/-osx//g') + fi + else + LINK=$(curl -s -L $TSSDOCS | grep -iEo 'href=".*-linux-x64.zip"' | sed 's/href\=//g;s/"//g' | sort -r | head -n1) + REMOTE_VERSION=$(echo $LINK | grep -iEo '[0-9.]+-linux' | sed 's/-linux//g') + fi - [ -f $TSSLINK ] && CURRENT_VERSION=$($TSSLINK version) + TSSFOLDER="$HOME/.local/tss-sdk" + TSSLINK="$HOME/.local/bin/tss" - timestamp "Current version of the TSS-SDK: $CURRENT_VERSION" - timestamp "Remote version of the TSS-SDK: $REMOTE_VERSION" + [ -f $TSSLINK ] && CURRENT_VERSION=$($TSSLINK version) - if [ "$REMOTE_VERSION" == "$CURRENT_VERSION" ]; then - timestamp "The current version of the TSS-SDK is the same as the newest version" - return 0 - else - rm -rfv $TSSFOLDER $TSSLINK - mkdir $TSSFOLDER - timestamp "Downloading the newest version of the TSS-SDK" - timestamp "Link: $LINK" - wget $LINK -P $TSSFOLDER - unzip $TSSFOLDER/secretserver-sdk-*.zip -d $TSSFOLDER - rm -rfv $TSSFOLDER/secretserver-sdk-*.zip - ln -s $TSSFOLDER/tss $TSSLINK - chmod +x $TSSLINK - fi + timestamp "Current version of the TSS-SDK: $CURRENT_VERSION" + timestamp "Remote version of the TSS-SDK: $REMOTE_VERSION" + + if [ "$REMOTE_VERSION" == "$CURRENT_VERSION" ]; then + timestamp "The current version of the TSS-SDK is the same as the newest version" + return 0 + else + rm -rfv $TSSFOLDER $TSSLINK + mkdir $TSSFOLDER + timestamp "Downloading the newest version of the TSS-SDK" + timestamp "Link: $LINK" + wget $LINK -P $TSSFOLDER + unzip $TSSFOLDER/secretserver-sdk-*.zip -d $TSSFOLDER + rm -rfv $TSSFOLDER/secretserver-sdk-*.zip + ln -s $TSSFOLDER/tss $TSSLINK + chmod +x $TSSLINK + fi } function install_taplo() { - # Install taplo - $install taplo + # Install taplo + $install taplo } function install_precommit() { - # Install pre-commit - $pip install pre-commit $PIPEXTPRE + # Install pre-commit + $pip install pre-commit $PIPEXTPRE } function install_streamlink() { - # Install streamlink - $pip install streamlink $PIPEXTPRE + # Install streamlink + $pip install streamlink $PIPEXTPRE } function install_brew_programs() { - # Install brew programs - INSTALLED_PROGRAMS=$(brew list) - while IFS='' read -r line; do LIST_OF_PROGRAMS+=("$line"); done < <(cat "$HOME"/.brew_programs) - while IFS='' read -r line; do LIST_OF_PROGRAMS_CASK+=("$line"); done < <(cat "$HOME"/.brew_programs_cask) - while IFS='' read -r line; do LIST_OF_PROGRAMS_DISABLE+=("$line"); done < <(cat "$HOME"/.brew_programs_disable) + # Install brew programs + INSTALLED_PROGRAMS=$(brew list) + while IFS='' read -r line; do LIST_OF_PROGRAMS+=("$line"); done < <(cat "$HOME"/.brew_programs) + while IFS='' read -r line; do LIST_OF_PROGRAMS_CASK+=("$line"); done < <(cat "$HOME"/.brew_programs_cask) + while IFS='' read -r line; do LIST_OF_PROGRAMS_DISABLE+=("$line"); done < <(cat "$HOME"/.brew_programs_disable) - for i in "${LIST_OF_PROGRAMS[@]}"; do - if [[ ! " ${INSTALLED_PROGRAMS[*]} " =~ ${i} ]] \ - && \ - [[ ! " ${LIST_OF_PROGRAMS_DISABLE[*]} " =~ ${i} ]]; then - brew install $i --force - fi - done + for i in "${LIST_OF_PROGRAMS[@]}"; do + if [[ ! " ${INSTALLED_PROGRAMS[*]} " =~ ${i} ]] && + [[ ! " ${LIST_OF_PROGRAMS_DISABLE[*]} " =~ ${i} ]]; then + brew install $i --force + fi + done - for i in "${LIST_OF_PROGRAMS_CASK[@]}"; do - if [[ ! " ${INSTALLED_PROGRAMS[*]} " =~ ${i} ]] \ - && \ - [[ ! " ${LIST_OF_PROGRAMS_DISABLE[*]} " =~ ${i} ]]; then - brew install $i --cask --force - fi - done + for i in "${LIST_OF_PROGRAMS_CASK[@]}"; do + if [[ ! " ${INSTALLED_PROGRAMS[*]} " =~ ${i} ]] && + [[ ! " ${LIST_OF_PROGRAMS_DISABLE[*]} " =~ ${i} ]]; then + brew install $i --cask --force + fi + done - xattr -r -d com.apple.quarantine /Applications/Spotify.app - xattr -r -d com.apple.quarantine /Applications/Stats.app + xattr -r -d com.apple.quarantine /Applications/Spotify.app + xattr -r -d com.apple.quarantine /Applications/Stats.app - xattr -r -d com.apple.quarantine /opt/homebrew/bin/mpv /Applications/mpv.app - duti -s io.mpv avi all - duti -s io.mpv mkv all - duti -s io.mpv mp4 all - duti -s io.mpv ts all + xattr -r -d com.apple.quarantine /opt/homebrew/bin/mpv /Applications/mpv.app + duti -s io.mpv avi all + duti -s io.mpv mkv all + duti -s io.mpv mp4 all + duti -s io.mpv ts all - xattr -r -d com.apple.quarantine /Applications/qView.app - duti -s com.interversehq.qView public.jpeg all - duti -s com.interversehq.qView public.png all - duti -s com.interversehq.qView com.compuserve.gif all - duti -s com.interversehq.qView public.tiff all + xattr -r -d com.apple.quarantine /Applications/qView.app + duti -s com.interversehq.qView public.jpeg all + duti -s com.interversehq.qView public.png all + duti -s com.interversehq.qView com.compuserve.gif all + duti -s com.interversehq.qView public.tiff all - xattr -r -d com.apple.quarantine /Applications/chatterino.app + xattr -r -d com.apple.quarantine /Applications/chatterino.app - brew cleanup --prune=all + brew cleanup --prune=all } function install_winbox_old() { - curl -o /tmp/winbox64.exe \ - "$(curl --silent https://mikrotik.com/download | grep -o 'https:\/\/download.*winbox64.exe')" - mv -v /tmp/winbox64.exe ~/Applications/winbox.exe - xattr -cr ~/Applications/winbox.exe + curl -o /tmp/winbox64.exe \ + "$(curl --silent https://mikrotik.com/download | grep -o 'https:\/\/download.*winbox64.exe')" + mv -v /tmp/winbox64.exe ~/Applications/winbox.exe + xattr -cr ~/Applications/winbox.exe } function install_prettier() { - $install prettier - $install prettierd + $install prettier + $install prettierd } function install_google_cloud_sdk() { - # Install google cloud sdk - if [[ "$(uname)" == "Darwin" ]]; then - $install google-cloud-sdk - else - curl -s https://sdk.cloud.google.com | bash - fi + # Install google cloud sdk + if [[ "$(uname)" == "Darwin" ]]; then + $install google-cloud-sdk + else + curl -s https://sdk.cloud.google.com | bash + fi } function install_lib_wandio() { - local REPO="LibtraceTeam/wandio" - local REMOTE_VERSION=$(curl -s \ - https://api.github.com/repos/$REPO/releases/latest | - grep -iEo '"tag_name":.*' | - sed 's/"tag_name"://g;s/"//g;s/,//g;s/ //g') - local RELEASE="${REMOTE_VERSION}.tar.gz" - local DEST="/tmp/wandio-$REMOTE_VERSION.tar.gz" - local DEST_FOLDER="/tmp/wandio-$REMOTE_VERSION" + local REPO="LibtraceTeam/wandio" + local REMOTE_VERSION=$(curl -s \ + https://api.github.com/repos/$REPO/releases/latest | + grep -iEo '"tag_name":.*' | + sed 's/"tag_name"://g;s/"//g;s/,//g;s/ //g') + local RELEASE="${REMOTE_VERSION}.tar.gz" + local DEST="/tmp/wandio-$REMOTE_VERSION.tar.gz" + local DEST_FOLDER="/tmp/wandio-$REMOTE_VERSION" - $install autoconf automake libtool - wget https://github.com/$REPO/archive/refs/tags/$RELEASE -O $DEST - tar -xvf $DEST -C /tmp - cd $DEST_FOLDER || err "Folder $DEST_FOLDER has been NOT found" - ./bootstrap.sh - ./configure - make -j"$(nproc)" - sudo make install && timestamp "Installed the newest version of the $REPO" - rm -rfv $DEST $DEST_FOLDER + $install autoconf automake libtool + wget https://github.com/$REPO/archive/refs/tags/$RELEASE -O $DEST + tar -xvf $DEST -C /tmp + cd $DEST_FOLDER || err "Folder $DEST_FOLDER has been NOT found" + ./bootstrap.sh + ./configure + make -j"$(nproc)" + sudo make install && timestamp "Installed the newest version of the $REPO" + rm -rfv $DEST $DEST_FOLDER } function install_bgpreader() { - local CURRENT_VERSION="0.0.0" - local REPO="CAIDA/libbgpstream" - local NAME="${REPO##*/}" - local REMOTE_VERSION=$(curl -s \ - https://api.github.com/repos/$REPO/releases/latest | - grep -iEo '"tag_name":.*' | - sed 's/"tag_name"://g;s/"//g;s/,//g;s/ //g') - local RELEASE="$NAME-${REMOTE_VERSION/v/}.tar.gz" - local DEST="/tmp/$NAME-$REMOTE_VERSION.tar.gz" - local DEST_FOLDER="/tmp/$NAME-$REMOTE_VERSION" + local CURRENT_VERSION="0.0.0" + local REPO="CAIDA/libbgpstream" + local NAME="${REPO##*/}" + local REMOTE_VERSION=$(curl -s \ + https://api.github.com/repos/$REPO/releases/latest | + grep -iEo '"tag_name":.*' | + sed 's/"tag_name"://g;s/"//g;s/,//g;s/ //g') + local RELEASE="$NAME-${REMOTE_VERSION/v/}.tar.gz" + local DEST="/tmp/$NAME-$REMOTE_VERSION.tar.gz" + local DEST_FOLDER="/tmp/$NAME-$REMOTE_VERSION" - if command_exists bgpreader; then - CURRENT_VERSION="v$(bgpreader -v 2>&1 | grep -ioE '[0-9\.]+')" - fi + if command_exists bgpreader; then + CURRENT_VERSION="v$(bgpreader -v 2>&1 | grep -ioE '[0-9\.]+')" + fi - if [ "$CURRENT_VERSION" == "$REMOTE_VERSION" ]; then - timestamp "The current version of the BGPREADER is the same as the newest version" - return 0 - else - $install autoconf automake libtool - command_start install_lib_wandio - wget https://github.com/$REPO/releases/download/$REMOTE_VERSION/$RELEASE -O $DEST - tar -xvf $DEST -C /tmp - cd /tmp/$NAME-* || err "Folder /tmp/$NAME-* has been NOT found" - ./configure --without-kafka - make -j"$(nproc)" - sudo make install && timestamp "Installed the newest version of the $REPO" - rm -rfv /tmp/$NAME-* - fi + if [ "$CURRENT_VERSION" == "$REMOTE_VERSION" ]; then + timestamp "The current version of the BGPREADER is the same as the newest version" + return 0 + else + $install autoconf automake libtool + command_start install_lib_wandio + wget https://github.com/$REPO/releases/download/$REMOTE_VERSION/$RELEASE -O $DEST + tar -xvf $DEST -C /tmp + cd /tmp/$NAME-* || err "Folder /tmp/$NAME-* has been NOT found" + ./configure --without-kafka + make -j"$(nproc)" + sudo make install && timestamp "Installed the newest version of the $REPO" + rm -rfv /tmp/$NAME-* + fi } function install_font_terminess() { - local REPO="ryanoasis/nerd-fonts" - local REMOTE_VERSION=$(curl -s \ - https://api.github.com/repos/$REPO/releases/latest | - grep -iEo '"tag_name":.*' | - sed 's/"tag_name"://g;s/"//g;s/,//g;s/ //g') - local RELEASE="Terminus.zip" - local DEST="/tmp/Terminess" + local REPO="ryanoasis/nerd-fonts" + local REMOTE_VERSION=$(curl -s \ + https://api.github.com/repos/$REPO/releases/latest | + grep -iEo '"tag_name":.*' | + sed 's/"tag_name"://g;s/"//g;s/,//g;s/ //g') + local RELEASE="Terminus.zip" + local DEST="/tmp/Terminess" - if [ ! -f $HOME/Library/Fonts/TerminessNerdFont-Regular.ttf ]; then - mkdir -p $DEST - cd $DEST || err "Folder $DEST has been NOT found" - wget https://github.com/$REPO/releases/download/$REMOTE_VERSION/$RELEASE -O $DEST/$RELEASE - unzip $RELEASE -d $DEST - mv $DEST/*.ttf ~/Library/Fonts - cd $HOME || err "Folder $HOME has been NOT found" - rm -rfv $DEST - fi + if [ ! -f $HOME/Library/Fonts/TerminessNerdFont-Regular.ttf ]; then + mkdir -p $DEST + cd $DEST || err "Folder $DEST has been NOT found" + wget https://github.com/$REPO/releases/download/$REMOTE_VERSION/$RELEASE -O $DEST/$RELEASE + unzip $RELEASE -d $DEST + mv $DEST/*.ttf ~/Library/Fonts + cd $HOME || err "Folder $HOME has been NOT found" + rm -rfv $DEST + fi } function main() { - command_start update_pip - command_start install_neovim_module_for_python - command_start install_node - command_start install_go - # command_start install_pyright - command_start install_mdformat - command_start install_ruff - command_start install_lazy - command_start install_dlv - command_start install_bash-language-server - command_start install_yaml-language-server - command_start install_marksman - command_start install_shfmt - command_start install_shellcheck - command_start install_gopls - # command_start install_terraform - command_start install_terraform_stable - command_start install_terragrunt - command_start install_azure_cli - command_start install_ansible - command_start install_meraki_ansible - command_start install_ansible-language-server - command_start install_ytdlp - command_start install_spotifydl - command_start install_awscli - command_start install_aws_adfs - command_start install_speedtest - command_start install_gh_cli - command_start install_kubernetes - command_start install_rust - command_start install_tss_client - command_start install_taplo - command_start install_precommit - command_start install_streamlink - command_start install_fzf - command_start install_winbox_old - command_start install_prettier - command_start install_google_cloud_sdk - command_start install_bgpreader - command_start install_font_terminess - command_start install_zsh_addons - command_start install_brew_programs + # command_start update_pip + # command_start install_neovim_module_for_python + # command_start install_node + # command_start install_go + # # command_start install_pyright + # command_start install_mdformat + # command_start install_ruff + # command_start install_lazy + # command_start install_dlv + # command_start install_bash-language-server + # command_start install_yaml-language-server + # command_start install_marksman + # command_start install_shfmt + # command_start install_shellcheck + # command_start install_gopls + # # command_start install_terraform + command_start install_terraform_stable + command_start install_terragrunt + command_start install_azure_cli + command_start install_ansible + command_start install_meraki_ansible + command_start install_ansible-language-server + command_start install_ytdlp + command_start install_spotifydl + command_start install_awscli + command_start install_aws_adfs + command_start install_speedtest + command_start install_gh_cli + command_start install_kubernetes + command_start install_rust + command_start install_tss_client "1.5.9" + command_start install_taplo + command_start install_precommit + command_start install_streamlink + command_start install_fzf + command_start install_winbox_old + command_start install_prettier + command_start install_google_cloud_sdk + command_start install_bgpreader + command_start install_font_terminess + command_start install_zsh_addons + command_start install_brew_programs } main diff --git a/.local/bin/mount-synology b/.local/bin/mount-synology index 7878ede..8456fcf 100755 --- a/.local/bin/mount-synology +++ b/.local/bin/mount-synology @@ -1,13 +1,23 @@ #!/bin/bash ~/.local/bin/sidebar-restore-macos open -gj "afp://10.0.0.14/Downloads" +sleep 10 open -gj "afp://10.0.0.14/Anime" +sleep 2 open -gj "afp://10.0.0.14/Music" +sleep 2 open -gj "afp://10.0.0.14/Video" +sleep 2 open -gj "afp://10.0.0.14/Series" +sleep 2 open -gj "afp://10.0.0.14/Photos" +sleep 2 open -gj "afp://10.0.0.14/Backups" +sleep 2 open -gj "afp://10.0.0.14/Recordings" +sleep 2 +open -gj "afp://10.0.0.14/Work" +sleep 2 /usr/local/bin/mysides add Synology file:///Volumes/Recordings/ /usr/local/bin/mysides add Synology file:///Volumes/Backups/ @@ -17,3 +27,4 @@ open -gj "afp://10.0.0.14/Recordings" /usr/local/bin/mysides add Synology file:///Volumes/Series/ /usr/local/bin/mysides add Synology file:///Volumes/Photos/ /usr/local/bin/mysides add Synology file:///Volumes/Anime/ +/usr/local/bin/mysides add Synology file:///Volumes/Work diff --git a/.local/bin/sidebar-restore-macos b/.local/bin/sidebar-restore-macos index 7804c3d..ad6d284 100755 --- a/.local/bin/sidebar-restore-macos +++ b/.local/bin/sidebar-restore-macos @@ -1,11 +1,10 @@ #!/bin/bash /usr/local/bin/mysides remove all -/usr/local/bin/mysides add yorune file:///Users/yorune/ -/usr/local/bin/mysides add Git file:///Users/yorune/git/ -/usr/local/bin/mysides add Linux file:///Users/yorune/MEGA/Systems/Linux/ -/usr/local/bin/mysides add Downloads file:///Users/yorune/Downloads/ -/usr/local/bin/mysides add Aplikacje file:///Applications/ -/usr/local/bin/mysides add Pictures file:///Users/yorune/Pictures/ -/usr/local/bin/mysides add Screenshots file:///Users/yorune/Screenshots/ -/usr/local/bin/mysides add Movies file:///Users/yorune/Movies/ -/usr/local/bin/mysides add Desktop file:///Users/yorune/Desktop/ +/usr/local/bin/mysides add Home file://"$HOME"/ +/usr/local/bin/mysides add Git file://"$HOME"/git/ +/usr/local/bin/mysides add Linux file://"$HOME"/MEGA/Systems/Linux/ +/usr/local/bin/mysides add Downloads file://"$HOME"/Downloads/ +# /usr/local/bin/mysides add Aplications file:///Applications/ +# /usr/local/bin/mysides add Aplications file:///"$HOME"/Applications/ +/usr/local/bin/mysides add Screenshots file://"$HOME"/Screenshots/ +/usr/local/bin/mysides add Desktop file://"$HOME"/Desktop/ diff --git a/.zshrc b/.zshrc index a0f8ff1..d5be513 100644 --- a/.zshrc +++ b/.zshrc @@ -162,7 +162,7 @@ if [[ "$(uname)" == "Darwin" ]]; then alias ls="ls -Gh" alias mpv="mpv --ytdl-raw-options="yes-playlist=" --no-resume-playback --ytdl-format='bestvideo+bestaudio/best'" alias code="open -a 'Visual Studio Code'" - alias xclip="pbcopy" + alias xclip="sed $'s,\x1b\\[[0-9;]*[a-zA-Z],,g' | pbcopy" alias mtr="sudo /opt/homebrew/opt/mtr/sbin/mtr" alias sleep-lid-off="sudo pmset -b sleep 0; sudo pmset -b disablesleep 1" alias sleep-lid-on="sudo pmset -b sleep 5; sudo pmset -b disablesleep 0" @@ -172,13 +172,13 @@ if [[ "$(uname)" == "Darwin" ]]; then # Terraform export TFENV_ARCH=amd64 export TFENVVERSION=$(ls -la /opt/homebrew/Cellar/tfenv/ | - grep -iEo '[0-9]\.[0-9]\.[0-9]' | + grep -iEo '[0-9]+\.[0-9]+\.[0-9]+' | sort | - tail -n1) + head -n1) export TFVERSION=$(ls -la /opt/homebrew/Cellar/tfenv/*/versions | - grep -iEo '[0-9]\.[0-9]\.[0-9]' | + grep -iEo '[0-9]+\.[0-9]+\.[0-9]+' | sort | - tail -n1) + head -n1) export PATH=$PATH:/opt/homebrew/Cellar/tfenv/$TFENVVERSION/versions/$TFVERSION/ # Unset browser @@ -229,7 +229,7 @@ alias neofetch=fastfetch [ -f $(which zoxide) ] && {eval "$(zoxide init zsh)"; alias cd='z'} # GoLang -alias go-mod="go mod edit -go $(go version | grep -oE 'go[0-9]*\.[0-9]*\.[0-9]*' | sed 's/go//g'); go get -u; go mod verify; go get -x -v; go mod verify; go mod tidy" +alias go-mod="go mod edit -go=$(go version | grep -oE 'go[0-9]*\.[0-9]*\.[0-9]*' | sed 's/go//g'); go get -u; go mod verify; go get -x -v; go mod verify; go mod tidy" # Resolve problem with - zsh: no matches found setopt +o nomatch