From 7c558606b286bbea41ca20668b475540c8376757 Mon Sep 17 00:00:00 2001 From: Bruno Fontes Date: Fri, 1 Dec 2023 19:00:54 -0300 Subject: [PATCH] More messed tests and stuff --- Backup/.Backup_HD.sh | 6 ++++-- Backup/.lastDisk | 2 +- Pacman/updateRepositories.sh | 3 +++ Screen/old_laptop.sh | 7 +++++-- Services/backup-contabo.sh | 5 ++++- Services/backup-memsource.service | 6 ++++++ Services/backup-memsource.timer | 11 +++++++++++ browser.sh | 15 ++++++++------- downloadYTvideos.sh | 4 ++++ holiday.sh | 15 +++++++++++++++ oxo-gif.sh | 9 +++++++++ start-dev.sh | 9 --------- start-oxo.sh | 8 ++++++++ 13 files changed, 78 insertions(+), 22 deletions(-) create mode 100755 Services/backup-memsource.service create mode 100755 Services/backup-memsource.timer create mode 100755 downloadYTvideos.sh create mode 100755 holiday.sh create mode 100755 oxo-gif.sh diff --git a/Backup/.Backup_HD.sh b/Backup/.Backup_HD.sh index 07f24a6..d181410 100755 --- a/Backup/.Backup_HD.sh +++ b/Backup/.Backup_HD.sh @@ -27,7 +27,8 @@ function backupNoCompression () { # $2 - Backup name # $3 - Files/Folders to backup prepareFolder $1 - echo -e "${blue} `date +%r` - Backing up (uncompressed)...${reset}" + DS=$(diskSpace $1) + echo -e "${blue} `date +%r` - Backing up (uncompressed)...${reset} [Free disk space: $DS ]" ionice -c 3 nice -n 19 borg create --compression none --exclude-from=./exclude "$1::$2" "$3" checkBackup $1 } @@ -54,7 +55,8 @@ function checkBackup() { } function pruneBackup() { - echo -e "${blue} `date +%r` - Prune old backups...${reset}" + DS=$(diskSpace $1) + echo -e "${blue} `date +%r` - Prune old backups...${reset} [Free disk space: $DS ]" borg prune --keep-weekly=4 --keep-monthly=12 --keep-yearly=1 $1 borg compact $1 } diff --git a/Backup/.lastDisk b/Backup/.lastDisk index 0cfbf08..d00491f 100644 --- a/Backup/.lastDisk +++ b/Backup/.lastDisk @@ -1 +1 @@ -2 +1 diff --git a/Pacman/updateRepositories.sh b/Pacman/updateRepositories.sh index db97b13..a0eb221 100755 --- a/Pacman/updateRepositories.sh +++ b/Pacman/updateRepositories.sh @@ -14,12 +14,15 @@ set -e s -v bold "Updating..." +s nice --adjustment=18 ionice -c 3 pacman -Syu nice --adjustment=18 ionice -c 3 yay -Syu --sudoloop --answerclean none --answerdiff all --answerupgrade all --noremovemake --norebuild --noredownload --nobatchinstall --cleanafter bold "Cleaning stuff..." s -v yay -Sc --noconfirm 2>/dev/null s -v +yay -Yc 2>/dev/null +s -v yes | (sudo -S pacman -Rns $(pacman -Qtdq) --color always 2>/dev/null) s -k diff --git a/Screen/old_laptop.sh b/Screen/old_laptop.sh index e6cebb9..2767b52 100755 --- a/Screen/old_laptop.sh +++ b/Screen/old_laptop.sh @@ -1,4 +1,7 @@ #!/bin/sh setxkbmap -model abnt2 -layout br -variant ,abnt2 -xrandr --output HDMI-1 --mode 1280x800 -xrandr --output HDMI-2 --mode 1280x800 +#xrandr --output HDMI-1 --mode 1280x800 +#xrandr --output HDMI-2 --mode 1280x800 +xrandr --output HDMI2 --mode 1280x800 --pos 0x0 --rate 59.79 \ + --output HDMI1 --mode 1280x800 --right-of HDMI2 --rate 60.00 + diff --git a/Services/backup-contabo.sh b/Services/backup-contabo.sh index b5f33a0..4b82ef7 100755 --- a/Services/backup-contabo.sh +++ b/Services/backup-contabo.sh @@ -13,7 +13,10 @@ if [[ -z $CONTABO_BACKUP_PATH ]]; then fi sleep 60 -ntfy="/home/bruno/Apps/linuxShortcuts/ntfy.sh --title Backup" +function ntfy() { + /home/bruno/Apps/linuxShortcuts/ntfy.sh --title Backup $1 +} + OXO_PATH="/home/bruno/Backups/OXOwebsite/" # Backup Contabo diff --git a/Services/backup-memsource.service b/Services/backup-memsource.service new file mode 100755 index 0000000..191296c --- /dev/null +++ b/Services/backup-memsource.service @@ -0,0 +1,6 @@ +[Unit] +Description=Backup memsource daily +OnFailure=logErrors@%n.service + +[Service] +ExecStart=/bin/konsole --workdir /run/media/bruno/Multimedia/MyDocuments/Development/Ccaps/BackupMemsourceLive/src -e php index.php diff --git a/Services/backup-memsource.timer b/Services/backup-memsource.timer new file mode 100755 index 0000000..95e0b32 --- /dev/null +++ b/Services/backup-memsource.timer @@ -0,0 +1,11 @@ +[Unit] +Description=Backup memsource daily + +[Timer] +Persistent=true +OnCalendar=*-*-* 10:30:00 +WakeSystem=true +#DayOfWeek Year-Month-Day Hour:Minute:Second + +[Install] +WantedBy=timers.target diff --git a/browser.sh b/browser.sh index 3548cc2..088ccee 100755 --- a/browser.sh +++ b/browser.sh @@ -1,14 +1,15 @@ #!/bin/zsh activity=$(kactivities-cli --current-activity | cut -d" " -f3) -if [[ $1 =~ .*youtube\.com.* ]]; then - mpv "$*" >/dev/null 2>&1 & - exit -fi +MPV=0 +[[ $1 =~ .*youtube\.com.* ]] && MPV=1 +[[ $1 =~ .*youtu\.be.* ]] && MPV=1 +[[ $1 =~ .*peertube.* ]] && MPV=1 +[[ $1 =~ .*yewtu\.be.* ]] && MPV=1 -if [[ $1 =~ .*youtu\.be.* ]]; then +if [[ $MPV == "1" ]]; then mpv "$*" >/dev/null 2>&1 & - exit + exit 0 fi # if [[ $1 =~ .*\&incognitottt$ ]]; then @@ -21,6 +22,6 @@ fi # fi [[ $activity == "OXO" ]] && /bin/firefox -P OXO "$1" >/dev/null 2>&1 & -[[ $activity == "Development" ]] && /home/bruno/Apps/firefox/firefox-bin "$1" >/dev/null 2>&1 & +[[ $activity == "Development" ]] && /bin/firefox -P DEV "$1" >/dev/null 2>&1 & [[ $activity == "Main" ]] && /bin/firefox "$1" >/dev/null 2>&1 & [[ $activity == "Videos" ]] && /bin/firefox "$1" >/dev/null 2>&1 & diff --git a/downloadYTvideos.sh b/downloadYTvideos.sh new file mode 100755 index 0000000..39b4047 --- /dev/null +++ b/downloadYTvideos.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +URL=$1 +yt-dlp -o "%(title)s/%(title)s [%(id)s].%(ext)s" -o "thumbnail:%(title)s/cover.%(ext)s" --write-thumbnail --convert-thumbnails jpg --write-description --embed-chapters --embed-metadata --write-subs "$URL" diff --git a/holiday.sh b/holiday.sh new file mode 100755 index 0000000..32342ea --- /dev/null +++ b/holiday.sh @@ -0,0 +1,15 @@ +#!/bin/bash -- + +tomorrow=$(date --date='tomorrow' +%Y-%m-%d) + +while read row +do + holiday=$(echo "$row" | cut -d , -f 1) + if [[ "$holiday" == "$tomorrow" ]] + then + echo "$row" | cut -d , -f 2 + exit 1 + fi +done /dev/null & -# opening=1 -#fi -#if [ $opening ] -#then -# sleep 4 -#fi TERMINATOR="0,1988,61,1760,880" QUTE="0,90,78,1715,900" diff --git a/start-oxo.sh b/start-oxo.sh index 8af3109..255f4c6 100755 --- a/start-oxo.sh +++ b/start-oxo.sh @@ -35,6 +35,14 @@ then openingProgram=1 fi + # KTimeTracker + if [[ -z $(pgrep --exact ktimetracker) ]] + then + echo "Opening KTimeTracker..." + /bin/ktimetracker >/dev/null 2>&1 & + openingProgram=1 + fi + if [ $openingProgram ] then sleep 5