diff --git a/Backup/runBackup.sh b/Backup/runBackup.sh index 25e9156..9082576 100755 --- a/Backup/runBackup.sh +++ b/Backup/runBackup.sh @@ -1 +1,2 @@ +#!/bin/sh /bin/terminator -m -T BACKUP -x sudo systemd-inhibit bash /home/bruno/Apps/linuxShortcuts/Backup/.Backup_HD.sh & diff --git a/Dolphin/extract.desktop b/Dolphin/extract.desktop new file mode 100644 index 0000000..c169a71 --- /dev/null +++ b/Dolphin/extract.desktop @@ -0,0 +1,14 @@ +# Copyright 2019 Bruno Fontes + +[Desktop Entry] +Type=Service +ServiceTypes=KonqPopupMenu/Plugin +MimeType=application/octet-stream;inode/directory +Actions=extract +X-KDE-Priority=TopLevel +X-KDE-Submenu=BFExtract + +[Desktop Action extract] +Name=Extract +Name[pt_BR]=Extrair +Exec=bash ~/.local/share/kservices5/ServiceMenus/extract.sh %F diff --git a/Dolphin/extract.sh b/Dolphin/extract.sh new file mode 100755 index 0000000..02b1392 --- /dev/null +++ b/Dolphin/extract.sh @@ -0,0 +1,23 @@ +#!/bin/bash +file="$1" +foldername="$(echo "$file" | sed 's/\(.*\)\..*/\1/')/" + +if [ -f "$file" ] ; then + case "$file" in + *.tar.bz2) tar xvjf "$file" -C "$foldername" ;; + *.tar.gz) tar xvzf "$file" -C "$foldername" ;; + *.bz2) bunzip2 "$file" "$foldername" ;; + *.rar) unrar x "$file" "$foldername" ;; + *.gz) gunzip "$file" "$foldername" ;; + *.tar) tar xvf "$file" -C "$foldername" ;; + *.tbz2) tar xvjf "$file" -C "$foldername" ;; + *.tgz) tar xvzf "$file" -C "$foldername" ;; + *.zip) unzip "$file" -d "$foldername" ;; + *.Z) uncompress "$file" "$foldername" ;; + *.7z) 7z x "$file" -o "$foldername" ;; + *) echo "'$file' cannot be extracted via >extract<" ;; + esac +else + echo "'$file' is not a valid file" +fi + diff --git a/Dolphin/{}-file b/Dolphin/{}-file new file mode 100644 index 0000000..e69de29 diff --git a/Pacman/updateRepositories.sh b/Pacman/updateRepositories.sh index 22229ab..a29605d 100755 --- a/Pacman/updateRepositories.sh +++ b/Pacman/updateRepositories.sh @@ -10,8 +10,9 @@ function s() { } s -v -bold "Pacman-mirrors -c" -s "pacman-mirrors -c Brazil" 2>/dev/null +bold "Pacman-mirrors --continent" +s "pacman-mirrors --continent" 2>/dev/null +# s "pacman-mirrors -c Brazil" 2>/dev/null s "reflector -l 30 -f 10 --save /etc/pacman.d/mirrorlist" 2>/dev/null # From now on, exit when any command fails diff --git a/Screen/desktop.sh b/Screen/desktop.sh new file mode 100755 index 0000000..9a5f6ae --- /dev/null +++ b/Screen/desktop.sh @@ -0,0 +1,3 @@ +#!/bin/sh +xrandr --output HDMI-1 --mode 1920x1080 +xrandr --output HDMI-2 --mode 1920x1080 diff --git a/Screen/new_laptop.sh b/Screen/new_laptop.sh new file mode 100755 index 0000000..6444fb6 --- /dev/null +++ b/Screen/new_laptop.sh @@ -0,0 +1,5 @@ +#!/bin/sh +setxkbmap -model abnt2 -layout br -variant ,abnt2 +xrandr --output HDMI-1 --mode 1280x720 #Max resolution monitor can do that fits blackout +xrandr --output HDMI-1 --mode 1366x768 #Max resolution monitor can do that fits blackout +xrandr --output HDMI-2 --mode 1366x768 diff --git a/Screen/old_laptop.sh b/Screen/old_laptop.sh new file mode 100755 index 0000000..e6cebb9 --- /dev/null +++ b/Screen/old_laptop.sh @@ -0,0 +1,4 @@ +#!/bin/sh +setxkbmap -model abnt2 -layout br -variant ,abnt2 +xrandr --output HDMI-1 --mode 1280x800 +xrandr --output HDMI-2 --mode 1280x800 diff --git a/Services/backup-contabo.sh b/Services/backup-contabo.sh index 5564231..d004fd1 100755 --- a/Services/backup-contabo.sh +++ b/Services/backup-contabo.sh @@ -10,7 +10,12 @@ if [[ -z $CONTABO_BACKUP_PATH ]]; then exit 1 fi sleep 60 -/bin/rsync --archive --exclude "files/nextcloud*" -e "ssh" backupContabo:/home/bruno/backups/* $CONTABO_BACKUP_PATH + +# Backup Contabo +/bin/rsync --archive --exclude "files/nextcloud*" --rsh=ssh backupContabo:/home/bruno/backups/* $CONTABO_BACKUP_PATH + +# Backup OXO +/bin/rsync --archive --rsh=ssh oxo:~/OXOwebsiteBackup.tar.gz ~/Backups/OXOwebsite/`date '+%Y-%m-%d'`_OXOwebsiteBackup.tar.gz # Delete old backups find $CONTABO_BACKUP_PATH/db -type f -name "*.sql.gz" -mtime +15 -delete @@ -19,3 +24,5 @@ find $CONTABO_BACKUP_PATH/files -type f -name "*.*" -mtime +35 -delete find $CONTABO_BACKUP_PATH/mail -type f -name "*.*" -mtime +20 -delete find $CONTABO_BACKUP_PATH/ -type f -name "*.*" -mtime +120 -delete + +find ~/Backups/OXOwebsite/ -type f -name "*.sql.gz" -mtime +15 -delete diff --git a/Services/backup-joplin.sh b/Services/backup-joplin.sh index 3500a65..a251259 100755 --- a/Services/backup-joplin.sh +++ b/Services/backup-joplin.sh @@ -1,7 +1,7 @@ #!/bin/bash BACKUP_DIR="/home/bruno/Backups/Joplin" -JOPLIN_BIN="/bin/joplin" +JOPLIN_BIN="/usr/bin/joplin" $JOPLIN_BIN sync $JOPLIN_BIN e2ee decrypt diff --git a/Services/minecraft-hour.sh b/Services/minecraft-hour.sh index 1c364b4..16c9ab9 100755 --- a/Services/minecraft-hour.sh +++ b/Services/minecraft-hour.sh @@ -15,6 +15,7 @@ SERVERDIR="/home/bruno/Apps/Minecraft" PUBLICDIR="$SERVERDIR/BedrockServer_Public_19132" SURVIVALDIR="$SERVERDIR/BedrockServer_Survival_19132" CREATIVEDIR="$SERVERDIR/BedrockServer_Creative_19134" +PATHTOBACKUP="" LogFile="log.txt" BACKUPDATE=$(date +"%Y-%m-%d_%H-%M-%S") @@ -40,16 +41,18 @@ if [[ $publicBackup ]]; then timeout=30 while [[ $finishedPublic != *"Data saved."* ]]; do if [[ $timeout -lt 1 ]]; then - notify-send "Error backuping Creative world" + notify-send "Error backuping Public world" + echo "Error Public $timeout" exit 1 fi (( timeout-- )) sleep 1s - runPublic "say ^usave query\n" + echo $tmeout + runPublic "^usave query\n" finishedPublic=$(tail -n 4 "$PUBLICDIR/$LogFile") + PATHTOBACKUP="$PATHTOBACKUP \"$PUBLICDIR\"" done - borg create --stats --compression auto,zstd,9 "$BACKUPDIR::$BACKUPDATE-MncftPublic" "$PUBLICDIR" - runPublic "say ^usave resume\n" + echo "Passou Public" fi if [[ $otherBackup ]]; then @@ -67,8 +70,7 @@ if [[ $otherBackup ]]; then runCreative "save query\n" finishedCreative=$(tail -n 4 "$CREATIVEDIR/$LogFile") done - runCreative "^u" - runCreative "save resume\n" + PATHTOBACKUP="$PATHTOBACKUP \"$CREATIVEDIR\"" timeout=30 finishedSurvival="" @@ -83,10 +85,12 @@ if [[ $otherBackup ]]; then runSurvival "save query\n" finishedSurvival=$(tail -n 4 "$SURVIVALDIR/$LogFile") done - - borg create --stats --compression auto,zstd,9 "$BACKUPDIR::$BACKUPDATE-MncftSurvival" "$SURVIVALDIR" - borg create --stats --compression auto,zstd,9 "$BACKUPDIR::$BACKUPDATE-MncftCreative" "$CREATIVEDIR" - runSurvival "^u" - runSurvival "save resume\n" + PATHTOBACKUP="$PATHTOBACKUP \"$SURVIVALDIR\"" fi + +[[ $PATHTOBACKUP ]] && borg create --stats --compression auto,zstd,9 "$BACKUPDIR::$BACKUPDATE" "$PATHTOBACKUP" + +[[ $publicBackup ]] && runPublic "say ^usave resume\n" +[[ $otherBackup ]] && runSurvival "say ^usave resume\n" && runCreative "say ^usave resume\n" + borg prune --keep-within=3d --keep-hourly=96 --keep-weekly=8 --keep-monthly=6 "$BACKUPDIR" diff --git a/Services/minecraft-server-public.sh b/Services/minecraft-server-public.sh new file mode 100644 index 0000000..36b8308 --- /dev/null +++ b/Services/minecraft-server-public.sh @@ -0,0 +1,50 @@ +if ! screen -list | grep -q "Minecraft"; then + exit 1 +fi + +BACKUPDIR="/home/bruno/Backups/zBackup-Minecraft/backups" +SERVERDIR="/home/bruno/Apps/Minecraft/BedrockServer_Public_19132" +LogFile="log.txt" + +alias run='screen -S MinecraftPublic -X' +alias runAllWorlds='run at "#" stuff' + +runAllWorlds "^u" +runAllWorlds "save hold\n" +sleep 2s + +finishedCreative="" +timeout=30 +while [[ $finishedCreative != *"Data saved."* ]]; do + if [[ $timeout -lt 1 ]]; then + notify-send "Error backuping Creative world" + exit 1 + fi + (( timeout-- )) + sleep 1s + runCreative "^u" + runCreative "save query\n" + finishedCreative=$(tail -n 4 "$CREATIVEDIR/$LogFile") +done + +timeout=30 +finishedSurvival="" +while [[ $finishedSurvival != *"Data saved."* ]]; do + if [[ $timeout -lt 1 ]]; then + notify-send "Error backuping Survival world" + exit 1 + fi + (( timeout-- )) + sleep 1s + runSurvival "^u" + runSurvival "save query\n" + finishedSurvival=$(tail -n 4 "$SURVIVALDIR/$LogFile") +done + +BACKUPDATE=$(date +"%Y-%m-%d_%H-%M-%S") +mkdir "$BACKUPDIR/$BACKUPDATE" +/bin/tar c "$SURVIVALDIR/worlds" | zbackup --non-encrypted backup "$BACKUPDIR/$BACKUPDATE/Survival" +/bin/tar c "$CREATIVEDIR/worlds" | zbackup --non-encrypted backup "$BACKUPDIR/$BACKUPDATE/Creative" + +runAllWorlds "^u" +runAllWorlds "save resume\n" diff --git a/Services/updateRootHints.service b/Services/updateRootHints.service index b4cd4f2..13fbb1d 100755 --- a/Services/updateRootHints.service +++ b/Services/updateRootHints.service @@ -4,4 +4,4 @@ OnFailure=logErrors@%n.service [Service] Type=oneshot -ExecStart = /bin/bash /home/bruno/dns_update_rootHints.sh +ExecStart = /bin/bash /home/bruno/Apps/linuxShortcuts/Services/roothints.sh diff --git a/Services/xpra@.service b/Services/xpra@.service new file mode 100644 index 0000000..bac1950 --- /dev/null +++ b/Services/xpra@.service @@ -0,0 +1,11 @@ +[Unit] +Description=xpra display + +[Service] +Type=simple +User=%i +EnvironmentFile=/etc/conf.d/xpra +ExecStart=/usr/bin/xpra --no-daemon start ${%i} + +[Install] +WantedBy=multi-user.target diff --git a/browser.sh b/browser.sh index f6cefc1..2f2d966 100755 --- a/browser.sh +++ b/browser.sh @@ -1,6 +1,11 @@ #!/bin/bash activity=`kactivities-cli --current-activity | cut -d" " -f3` +if [[ $1 =~ .*youtube\.com.* ]]; then + /bin/freetube "$*" >/dev/null 2>&1 & + exit +fi + if [[ $1 =~ .*\&incognitottt$ ]]; then url="${1/\&incognitottt/}" [[ $activity == "OXO" ]] && /bin/brave --incognito "$url" >/dev/null 2>&1 & diff --git a/start-dashboard b/start-dashboard new file mode 100755 index 0000000..b7fed0a --- /dev/null +++ b/start-dashboard @@ -0,0 +1,51 @@ +#!/bin/sh + +if [[ $(tmux ls | grep 'dashboard') ]]; then + terminator -T "Dashboard" -x tmux a -t dashboard & + exit +fi +echo "Iniciando Dashboard..." +sleep 2 +tmux new -d -s dashboard +tmux rename-window -t dashboard "Dashboard" +terminator -T "Dashboard" -x tmux a -t dashboard & +sleep 10 +tmux splitw -t dashboard +tmux splitw -h -t dashboard:0.0 +tmux resize-pane -U -t dashboard:0.2 15 +tmux resize-pane -L -t dashboard:0.1 10 +sleep 1 + +# 0 - Dashboard/khal +tmux send -t dashboard:0.0 $'clear;watch --interval $((30 * 60)) --no-title --color screenfetch\n' +tmux send -t dashboard:0.1 $'alias clear="clear;figlet Dashboard; echo -n Khal:\ ; khal list; echo;"\n' +tmux send -t dashboard:0.2 $'btop\n' +tmux send -t dashboard:0.1 $'clear\n' + +# 1 - Tut +tmux new-window -t dashboard +sleep 1 +tmux send -t dashboard:1.0 $'tut\n' +tmux rename-window -t dashboard:1 tut +tmux setw monitor-activity -t dashboard:1 + +# 2 - GoMuks +tmux new-window -t dashboard +sleep 1 +tmux send -t dashboard:2.0 $'gomuks\n' +tmux rename-window -t dashboard:2 gomuks + +# 3 - NeoMutt +tmux new-window -t dashboard +sleep 1 +tmux send -t dashboard:3.0 $'neomutt\n' +tmux rename-window -t dashboard:3 neomutt + +# 4 - Joplin +tmux new-window -t dashboard +sleep 1 +tmux send -t dashboard:4.0 $'joplin\n' +tmux rename-window -t dashboard:4 joplin + +tmux select-window -t dashboard:0 +tmux setw monitor-silence -t dashboard:0 diff --git a/stop-pmovase.sh b/stop-pmovase.sh new file mode 100755 index 0000000..b4a3044 --- /dev/null +++ b/stop-pmovase.sh @@ -0,0 +1,13 @@ +#!/bin/zsh +#if [[ !$(tmux ls | grep 'pmovase') ]]; then +# exit +#fi + +killall /home/bruno/Apps/firefox/firefox-bin +killall /bin/vscodium + +cd /home/bruno/development/projetomovase/ +vagrant suspend +tmux send -t pmovase:0.4 $'^u' +#tmux send -t pmovase:0.4 $'vagrant suspend &\n' +tmux kill-session -t pmovase diff --git a/tmuxStartDicionarios.sh b/tmuxStartDicionarios.sh new file mode 100755 index 0000000..97eeb9a --- /dev/null +++ b/tmuxStartDicionarios.sh @@ -0,0 +1,21 @@ +#!/bin/zsh + +projectName=dicionarioscc +cd /run/media/bruno/Multimedia/MyDocuments/Development/BrunoFontes/dicionarios.cc/ +if [[ $(tmux ls | grep '$projectName') ]]; then + uxterm -T $projectName -geometry 627x927 -e tmux a -t $projectName & + exit +fi + +tmux new -d -s $projectName + +tmux splitw -ht $projectName +tmux splitw -vt $projectName:0.1 +tmux splitw -vt $projectName:0.2 + +uxterm -T $projectName -geometry 627x927 -e tmux a -t $projectName & + +tmux send -t $projectName:0.0 $'nvim\n' +tmux send -t $projectName:0.1 $'make dev\n' +tmux send -t $projectName:0.2 $'tail -f src/dicio.log\n' +tmux send -t $projectName:0.3 $'gss\n' diff --git a/xrandr.sh b/xrandr.sh new file mode 100755 index 0000000..3cc2711 --- /dev/null +++ b/xrandr.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +xrandr --output HDMI-2 --left-of HDMI-1