This commit is contained in:
Dym Sohin 2024-02-24 14:31:19 +01:00
parent a5f3d109dc
commit 9f6f10f6a9
12 changed files with 108 additions and 279 deletions

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -7,14 +7,14 @@ sudo apt install -y \
sudo hddtemp /dev/sd* sudo hddtemp /dev/sd*
sudo sensors-detect # sudo sensors-detect
sudo sensors sudo sensors
free -h free -h
sensors # sensors
sudo hddtemp SATA:/dev/sda sudo hddtemp SATA:/dev/sda
sudo hddtemp SATA:/dev/sdb sudo hddtemp SATA:/dev/sdb

26
ggc.sh
View File

@ -1,7 +1,31 @@
#!/bin/sh #!/usr/bin/env zsh
# git cleanup # git cleanup
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 gc --aggressive
git repack -Ad git repack -Ad
git prune 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

View File

@ -1,8 +1,8 @@
#!/usr/bin/env zsh #!/usr/bin/env zsh
# purge memory # purge memory
free -h free -h
echo "clearing memory" echo "clearing memory"
sudo sync sudo sync
sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches' sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'
@ -10,26 +10,35 @@ free -h
# clear logs # clear logs
echo "clearing /var/log" echo "clearing logs"
sudo du -hs /var/log
sudo find /var/log -type f -delete
sudo du -hs /var/log 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 echo "clearing apache logs"
rm -rf /var/lib/systemd/coredump/*
echo "clearing /etc/apache2/logs"
sudo du -hs /etc/apache2/logs sudo du -hs /etc/apache2/logs
sudo find /etc/apache2/logs -type f -delete sudo find /etc/apache2/logs -type f -delete
sudo du -hs /etc/apache2/logs sudo du -hs /etc/apache2/logs
rm ~/.xsession-errors* echo "clearing nginx logs"
rm ~/.config/doublecmd/doublecmd.err sudo du -hs /etc/nginx/logs
rm ~/.mozilla/firefox/Crash\ Reports/ 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 # empty trash
rm -rf ~/.local/share/Trash sudo rm -rf ~/.local/share/Trash/*
sudo rm -rf /root/.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 /[A-Z]*/.Trash-1000
sudo rm -rf /media/*/.Trash-1000 sudo rm -rf /media/*/.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 sudo rm -rf /mnt/*/*/.Trash-1000
# rm -rf /_servers/*/.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 # vacuum firefox
kill -9 firefox kill -9 firefox
cd ~/.mozilla/firefox/dym/ cd ~/.mozilla/firefox/dym/
du -hs ~/.mozilla/firefox/dym/
find -maxdepth 1 -type f \ find -maxdepth 1 -type f \
| xargs file -F "" \ | xargs file -F "" \
| awk '/SQLite/{print $1}' \ | awk '/SQLite/{print $1}' \
| xargs -n 1 -I FILE bash -c \ | xargs -n 1 -I FILE bash -c \
'echo Vacuuming $1; sqlite3 $1 "vacuum;"' \ 'echo Vacuuming $1; sqlite3 $1 "vacuum;"' \
bash FILE bash FILE
du -hs ~/.mozilla/firefox/dym/
# Cleaning the old kernels # Cleaning the old kernels
dpkg-query -l | grep 'linux-im*' # dpkg-query -l | grep 'linux-im*'
#dpkg-query -l | grep linux-im* | awk '{print $2}' # #dpkg-query -l | grep linux-im* | awk '{print $2}'
sudo apt-get purge -y $(dpkg -l 'linux-*' \ # 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) \ # | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | head -n -1) \
--assume-yes # --assume-yes
sudo apt-get install -y linux-headers-`uname -r \ # sudo apt-get install -y linux-headers-`uname -r \
|cut -d'-' -f3`-`uname -r \ # |cut -d'-' -f3`-`uname -r \
|cut -d'-' -f4` # |cut -d'-' -f4`

View File

@ -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 /_/*\[button*.(jpg|png|gif|webp|avif|svg) "$UI_PATH"
mv /_/*\[card*.(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 /_/*\[app*.(jpg|png|gif|webp|avif|svg) "$UI_PATH"
mv /_/*\[ui\]*.(jpg|png|gif|webp|avif|svg) "$UI_PATH"
LOGO_PATH="/Img/identity/" LOGO_PATH="/Img/identity/"

View File

@ -1,4 +1,4 @@
#!/usr/bin/env zsh #!/bin/bash
NEW_SSH_EMAIL="$1" NEW_SSH_EMAIL="$1"

25
upd-forks.sh Executable file
View File

@ -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

11
upd.sh
View File

@ -6,8 +6,7 @@ sudo apt hold 'nvidia-*'
sudo apt upgrade -y sudo apt upgrade -y
sudo apt-get autoclean -y sudo apt-get autoclean -y
sudo apt-get remove --purge -y \ # sudo apt-get remove --purge -y software-properties-common
software-properties-common
sudo apt-get autoremove -y sudo apt-get autoremove -y
deborphan | xargs sudo apt-get -y remove --purge deborphan | xargs sudo apt-get -y remove --purge
sudo apt-get clean -y sudo apt-get clean -y
@ -22,6 +21,14 @@ cd ~/.oh-my-zsh/ \
# rust & co # rust & co
rustup update rustup update
cargo install-update -a cargo install-update -a
cargo cache --autoclean
# nix
nix upgrade-nix
# npm
npm i -g npm
npm up -g
# bun # bun
bun upgrade bun upgrade