diff --git a/bak-current.sh b/bak-current.sh deleted file mode 100755 index 968a378..0000000 --- a/bak-current.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env zsh - -BAK="/home/dym/Servers/self-files" -if [ ! -z "$1" ]; then - BAK="$1" -fi - - -cd `realpath "$0" | xargs dirname` -./bak-home.sh "$BAK/Home_bak" - -cp /home/dym/.config/doublecmd/doublecmd.xml \ - /Cfg/doublecmd/ - -DIRS=( - Apps - Cfg -) -for DIR in "${DIRS[@]}"; do - echo "- -- -# '/$DIR'" - sudo \ - rsync -zrhP --links --size-only --verbose --delete \ - --exclude '**/.Trash-1000' \ - --exclude '**/__sapper__/' \ - --exclude '**/node_modules/' \ - --exclude '**/target/' \ - "/$DIR/" \ - "$BAK/${DIR}_bak" -done - -echo "- -- -# '~/.privat'" -sudo \ -rsync -zrhP --links --size-only --verbose --delete \ - "/home/dym/.privat/" \ - "$BAK/.privat_bak" diff --git a/bak-current_to_archive.sh b/bak-current_to_archive.sh deleted file mode 100755 index d818e04..0000000 --- a/bak-current_to_archive.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env zsh - -BAK="/Data/_bak" - - -# restic init '/home/dym/.privat' \ -# -p '/home/dym/.privat/restic/p.txt' \ -# -r "$BAK/.privat" - -restic backup '/home/dym/.privat' \ - -p '/home/dym/.privat/restic/p.txt' \ - -r "$BAK/.privat_home" - - -cd `realpath "$0" | xargs dirname` -./bak-home.sh "$BAK/Home_deb" - - -sudo \ -rsync -zrhP --links --size-only --verbose --delete \ - --exclude '**/.Trash-1000' \ - --exclude '**/__sapper__/' \ - --exclude '**/node_modules/' \ - --exclude '**/target/' \ - "/Servers/self/My/" \ - "/Data/_my" - - -# sudo \ -# rsync -zrhP --links --size-only --verbose --delete \ -# --exclude '**/.Trash-1000' \ -# --exclude '**/__sapper__/' \ -# --exclude '**/node_modules/' \ -# --exclude '**/target/' \ -# "/Work/" \ -# "$BAK/work-CURRENT" - - -DIRS=( - _ - Books - Code - Img - Music - Ui - Forks - Fonts - Templates - Work -) -for DIR in "${DIRS[@]}"; do - echo "- -- -# '$DIR'" - sudo \ - rsync -zrhP --links --size-only --verbose --delete \ - --exclude '**/.Trash-1000' \ - --exclude '**/__sapper__/' \ - --exclude '**/node_modules/' \ - --exclude '**/target/' \ - "/Servers/self/$DIR/" \ - "$BAK/${DIR}" -done - -DIRS=( - Apps - Cfg -) -for DIR in "${DIRS[@]}"; do - echo "- -- -# '$DIR'" - sudo \ - rsync -zrhP --links --size-only --verbose --delete \ - --exclude '**/.Trash-1000' \ - --exclude '**/__sapper__/' \ - --exclude '**/node_modules/' \ - --exclude '**/target/' \ - "/$DIR/" \ - "$BAK/${DIR}" -done - - -sudo \ -rsync -zrhP --links --size-only --verbose --delete \ - "/var/lib/docker/" \ - "$BAK/var_lib_docker" diff --git a/bak-data.sh b/bak-data.sh deleted file mode 100755 index ffc419b..0000000 --- a/bak-data.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env zsh - -BAK="/media/data_bak" -if [ ! -z "$1" ]; then - BAK="$1" -fi - -DIRS=( - Apps_andr - Apps_deb - Apps_wnd - Audio - Books - Bugs - Code - Drivers - Fonts - Img - Iso - Music - Posts - Texts - Video -) -for DIR in "${DIRS[@]}"; do - echo "- -- -# '$DIR'" - sudo \ - rsync -zrhP --links --size-only --verbose --delete \ - --exclude '**/.Trash-1000' \ - "/Data/${DIR}/" \ - "$BAK/${DIR}" -done diff --git a/bak-home.sh b/bak-home.sh deleted file mode 100755 index d475758..0000000 --- a/bak-home.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env zsh - -# home.sh -BAK='/Data/_bak/Home_nix' -if [ ! -z "$1" ]; then - BAK="$1" -fi - -echo "BAK: backing up '$HOME' to '$BAK'" - -rsync -rhP --links --size-only --verbose --delete \ - --exclude '**/.Trash-1000/' \ - --exclude '**/*.log' \ - --exclude '**/*.part' \ - --exclude '**/*~' \ - --exclude '**/hyphen-data/' \ - --exclude '**/logs/' \ - --exclude '**/node_modules/' \ - --exclude '**/storage/default/' \ - --exclude '**/datareporting/' \ - --exclude '.android/' \ - --exclude '.bun/' \ - --exclude '.cabal/' \ - --exclude '.cache/' \ - --exclude '.cargo/' \ - --exclude '.cinnamon/' \ - --exclude '.config/agregore-browser/' \ - --exclude '.config/chromium/' \ - --exclude '.config/Code/Cache*' \ - --exclude '.config/Code/Crashpad/' \ - --exclude '.config/Code/Service Worker/' \ - --exclude '.config/Code/User/History/' \ - --exclude '.config/Code/User/workspaceStorage/' \ - --exclude '.config/google-chrome-unstable/' \ - --exclude '.config/google-chrome/' \ - --exclude '.config/vivaldi/' \ - --exclude '.config/xnviewmp/' \ - --exclude '.deno/' \ - --exclude '.docker/' \ - --exclude '.electron-gyp/' \ - --exclude '.figma/' \ - --exclude '.fonts/' \ - --exclude '.gnome/' \ - --exclude '.gnupg/' \ - --exclude '.gphoto/' \ - --exclude '.gradle/' \ - --exclude '.java/' \ - --exclude '.linuxmint/' \ - --exclude '.local/share/lutris' \ - --exclude '.local/share/Trash' \ - --exclude '.nix-defexpr' \ - --exclude '.nix-profile' \ - --exclude '.node/' \ - --exclude '.npm/' \ - --exclude '.nv/' \ - --exclude '.pipupgrade/' \ - --exclude '.pki/' \ - --exclude '.privat/' \ - --exclude '.Private/' \ - --exclude '.pub-cache/' \ - --exclude '.rustup/' \ - --exclude '.ssh' \ - --exclude '.steam*' \ - --exclude '.thunderbird' \ - --exclude '.zoom/' \ - --exclude 'Android/' \ - --exclude 'FontBase/' \ - --exclude 'Games/' \ - --exclude 'Cfg/' \ - --exclude 'Desktop/' \ - --exclude 'Inbox/' \ - --exclude 'My Games/' \ - --exclude 'go/' \ - --exclude 'Private/' \ - --exclude 'snap/' \ - --exclude 'Steam/' \ - --exclude 'Servers/' \ - --exclude 'tmp/' \ - "/home/dym/" \ - "$BAK" diff --git a/bak-server_to_archive.sh b/bak-server_to_archive.sh deleted file mode 100755 index 283dcc5..0000000 --- a/bak-server_to_archive.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env zsh - -BAK="/Data/_server" - - -rsync -zrhP --links --size-only --verbose --delete \ - "/Servers/infra/var/www/gotosocial/storage/" \ - "$BAK/gotosocial/storage" - diff --git a/device-info.sh b/device-info.sh index 67baf8f..cf60b74 100755 --- a/device-info.sh +++ b/device-info.sh @@ -7,14 +7,14 @@ sudo apt install -y \ sudo hddtemp /dev/sd* -sudo sensors-detect +# sudo sensors-detect sudo sensors free -h -sensors +# sensors sudo hddtemp SATA:/dev/sda sudo hddtemp SATA:/dev/sdb diff --git a/ggc.sh b/ggc.sh index cbfa39a..cd27505 100755 --- a/ggc.sh +++ b/ggc.sh @@ -1,7 +1,31 @@ -#!/bin/sh +#!/usr/bin/env zsh # git cleanup -git gc --aggressive -git repack -Ad -git prune +if [ ! -z "$1" ]; then + GIT_DIRS_PATH="$1" # i.e. '/Forks' + + FORKS=( `/bin/ls -A1 "$GIT_DIRS_PATH"` ) + + for FORK in "${FORKS[@]}"; do + if [ -d "$GIT_DIRS_PATH/$FORK" ]; then + cd "$GIT_DIRS_PATH/$FORK" + if [ -e "`pwd`/.git" ]; then + echo " +> '$GIT_DIRS_PATH/$FORK'" + git gc --aggressive + git repack -Ad + git prune + fi + cd "$GIT_DIRS_PATH" + fi + done + +else + # script called w/o additional argumants + cd `realpath "$0" | xargs dirname` + git gc --aggressive + git repack -Ad + git prune + +fi diff --git a/purge.sh b/purge.sh index 926a31a..dc1a581 100755 --- a/purge.sh +++ b/purge.sh @@ -1,8 +1,8 @@ #!/usr/bin/env zsh + # purge memory free -h - echo "clearing memory" sudo sync sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches' @@ -10,26 +10,35 @@ free -h # clear logs -echo "clearing /var/log" -sudo du -hs /var/log -sudo find /var/log -type f -delete +echo "clearing logs" sudo du -hs /var/log +sudo rm -rf /var/log/**.gz +sudo rm -rf /var/log/**.[1-9] +sudo du -hs /var/lib/docker/containers/*/*-json.log +sudo rm -rf /var/lib/docker/containers/*/*-json.log -# remove temp things -rm -rf /var/lib/systemd/coredump/* - -echo "clearing /etc/apache2/logs" +echo "clearing apache logs" sudo du -hs /etc/apache2/logs sudo find /etc/apache2/logs -type f -delete sudo du -hs /etc/apache2/logs -rm ~/.xsession-errors* -rm ~/.config/doublecmd/doublecmd.err -rm ~/.mozilla/firefox/Crash\ Reports/ +echo "clearing nginx logs" +sudo du -hs /etc/nginx/logs +sudo find /etc/nginx/logs -type f -delete +sudo du -hs /etc/nginx/logs + +# remove temp things +sudo du -hs /var/lib/systemd/coredump/ +sudo rm -rf /var/lib/systemd/coredump/* +sudo rm -rf ~/.xsession-errors* +sudo rm -rf ~/.config/doublecmd/doublecmd.err +sudo rm -rf ~/.mozilla/firefox/Crash\ Reports/ + # empty trash -rm -rf ~/.local/share/Trash +sudo rm -rf ~/.local/share/Trash/* sudo rm -rf /root/.local/share/Trash/* +sudo rm -rf /.Trash-1000 sudo rm -rf /[A-Z]*/.Trash-1000 sudo rm -rf /media/*/.Trash-1000 sudo rm -rf /media/*/*/.Trash-1000 @@ -37,24 +46,36 @@ sudo rm -rf /mnt/*/.Trash-1000 sudo rm -rf /mnt/*/*/.Trash-1000 # rm -rf /_servers/*/.Trash-1000 + +# remove nohup +sudo rm -rf /home/*/nohup.out + + +# prune unused docker images +sudo docker system prune -a -f + + # vacuum firefox kill -9 firefox cd ~/.mozilla/firefox/dym/ +du -hs ~/.mozilla/firefox/dym/ find -maxdepth 1 -type f \ | xargs file -F "" \ | awk '/SQLite/{print $1}' \ | xargs -n 1 -I FILE bash -c \ 'echo Vacuuming $1; sqlite3 $1 "vacuum;"' \ bash FILE +du -hs ~/.mozilla/firefox/dym/ -#Cleaning the old kernels -dpkg-query -l | grep 'linux-im*' -#dpkg-query -l | grep linux-im* | awk '{print $2}' -sudo apt-get purge -y $(dpkg -l 'linux-*' \ - | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | head -n -1) \ - --assume-yes +# Cleaning the old kernels +# dpkg-query -l | grep 'linux-im*' +# #dpkg-query -l | grep linux-im* | awk '{print $2}' -sudo apt-get install -y linux-headers-`uname -r \ - |cut -d'-' -f3`-`uname -r \ - |cut -d'-' -f4` +# sudo apt-get purge -y $(dpkg -l 'linux-*' \ +# | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | head -n -1) \ +# --assume-yes + +# sudo apt-get install -y linux-headers-`uname -r \ +# |cut -d'-' -f3`-`uname -r \ +# |cut -d'-' -f4` diff --git a/sort_out.sh b/sort_out.sh index 69486a7..0846054 100755 --- a/sort_out.sh +++ b/sort_out.sh @@ -19,6 +19,7 @@ mv /_/*\[step*.(jpg|png|gif|webp|avif|svg) "$UI_PATH" mv /_/*\[button*.(jpg|png|gif|webp|avif|svg) "$UI_PATH" mv /_/*\[card*.(jpg|png|gif|webp|avif|svg) "$UI_PATH" mv /_/*\[app*.(jpg|png|gif|webp|avif|svg) "$UI_PATH" +mv /_/*\[ui\]*.(jpg|png|gif|webp|avif|svg) "$UI_PATH" LOGO_PATH="/Img/identity/" diff --git a/ssh-keygen.sh b/ssh-keygen.sh index 662501c..9320460 100755 --- a/ssh-keygen.sh +++ b/ssh-keygen.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env zsh +#!/bin/bash NEW_SSH_EMAIL="$1" diff --git a/upd-forks.sh b/upd-forks.sh new file mode 100755 index 0000000..8634123 --- /dev/null +++ b/upd-forks.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env zsh + +GIT_DIRS_PATH='/Forks' +if [ ! -z "$1" ]; then + GIT_DIRS_PATH="$1" +fi + +FORKS=( `/bin/ls -A1 "$GIT_DIRS_PATH"` ) + +for FORK in "${FORKS[@]}"; do + + if [ -d "$GIT_DIRS_PATH/$FORK" ]; then + cd "$GIT_DIRS_PATH/$FORK" + + if [ -e "`pwd`/.git" ]; then + echo " +> '$GIT_DIRS_PATH/$FORK'" + git pull --depth 1 + fi + + cd "$GIT_DIRS_PATH" + + fi + +done diff --git a/upd.sh b/upd.sh index 22772c5..a50e3ac 100755 --- a/upd.sh +++ b/upd.sh @@ -6,8 +6,7 @@ sudo apt hold 'nvidia-*' sudo apt upgrade -y sudo apt-get autoclean -y -sudo apt-get remove --purge -y \ - software-properties-common +# sudo apt-get remove --purge -y software-properties-common sudo apt-get autoremove -y deborphan | xargs sudo apt-get -y remove --purge sudo apt-get clean -y @@ -22,6 +21,14 @@ cd ~/.oh-my-zsh/ \ # rust & co rustup update cargo install-update -a +cargo cache --autoclean + +# nix +nix upgrade-nix + +# npm +npm i -g npm +npm up -g # bun bun upgrade