move all existing in subfolders

This commit is contained in:
trnq1ll0 committed 2025-03-11 23:16:02 +01:00
1 parent cc069f63ef
commit 6491336e60
48 files changed

No files matched your search

+55
View File
@@ -0,0 +1,55 @@
## functions
alias ll='ls -lahF -c -lt --group-directories-first'
alias l='ls -lachF --group-directories-first'
## ls with filesize sort by size
alias lt='ls --human-readable --size -1 -S --classify'
# finden von Dateiausdrücken
find_file() {
find . -type f -name $1
}
alias ff='find_file $1'
# finden von Verzeichnisausdrücken
find_directory() {
find . -type d -name $1
}
alias fd='find_directory $1'
# meine Befehlesammlung
alias befehle='/home/rob/code/lokale-scripte/befehle.sh'
# damit tmux immer (jeweils nur ein Mal) mit meiner config startet
alias tmuxx='tmux new-session -A -s prism'
# mein tmux default layout laden
alias tmuxxx='/home/rob/code/lokale-scripte/tmux_layout.sh'
#LED Stripe demo :-)
alias led-stripe-demo='python /home/rob/code/c3d2/led-stripe/demo.py'
## den c3d2 calender pullen und editieren
alias c3d2_edit_calender="/home/rob/code/lokale-scripte/c3d2_edit_calendar.sh"
#### C3D2 ####
alias c3d2_route='echo "sudo route add default gw 172.22.99.4"; sudo route add default gw 172.22.99.4'
# löschen immer erst bestätigen lassen (y/N)
alias rm="rm -I"
# Monitor StandardSetup (oben+unten) laden
alias hdmi="/home/rob/code/lokale-scripte/hotplug_hdmi_monitor.sh"
# Rotverscheibug um die Augen zu schonen
alias red="/home/rob/code/lokale-scripte/red_the_screen.sh"
alias wifion="/home/rob/code/lokale-scripte/wifion.sh"
alias wifioff="/home/rob/code/lokale-scripte/wifioff.sh"
# python3 als default und python2 als option setzen
#alias python='/usr/bin/python3'
#alias python2='/usr/bin/python'
# restic backups ausführen
alias backup-me="/home/rob/code/lokale-scripte/restic/backup.sh"
alias backup-status="/home/rob/code/lokale-scripte/restic/backup-status.sh"
Executable
+8
View File
@@ -0,0 +1,8 @@
#!/bin/bash
#cut the percent out of acpi
batt=`acpi -b`
batt=($batt)
#echo "#[fg=red]♥♥♥#[fg=white]♥♥♥#[fg=black] ${batt[3]}"
batt="${batt[3]}"
##Nur Substring bis zum ersten Komma.
echo ${batt%,}
Executable
+5
View File
@@ -0,0 +1,5 @@
#!/bin/bash
#cut the percent out of acpi
batt=`acpi -b`
batt=($batt)
echo "#[fg=red]♥♥♥#[fg=black]♡♡♡ ${batt[3]}"
+34
View File
@@ -0,0 +1,34 @@
#!/bin/sh
# this one makes a copy of the whole /var/www/html from boogie to BFDS
SCRIPTPATH=$(dirname `realpath $0`)
cd $SCRIPTPATH
# rsync source -> destination
SOURCE_PATH=/var/www/virtual/boogie/html
DEST_PATH_FILES=/mnt/bfds/rob/backup/server/boogiedev.net/var_www
# path of the database backups
DEST_PATH_DB=/mnt/bfds/rob/backup/server/boogiedev.net/db
# EXCLUDE="--exclude-from exclude-list"
# ### Get all databases
# kick off DB dumping
curl --insecure --silent https://backup.boogiedev.net/dump_all_databases.php
# download DB dumps
cd $DEST_PATH_DB
curl --insecure --silent https://backup.boogiedev.net/dumps.zip > dumps.zip
if [ -f dumps.zip ]
then
today=`date +%F`
mv dumps.zip all_databases_dump_$today.zip
else
echo "Datenbank Dump konnte nicht herunter geladen werden"
fi
## aufräumen
curl --insecure --silent https://backup.boogiedev.net/dump_all_databases.php?cleanup_dump=1
+7
View File
@@ -0,0 +1,7 @@
backup_all_databases_cMxNrCTVLBPrNo6qaonojeejCvCepekwssh
nextcloud/config/config.php
nextcloud/data/root/files/Extern
nextcloud/updater
nextcloud/backup
/nextcloud-data/updater-*/
files_trashbin/
@@ -0,0 +1 @@
credentials.php
@@ -0,0 +1,6 @@
The content of this folder hast to be on the Boogie server at:
/var/www/virtual/boogie/html/backup-boogie
Its the server side enpoint of the backup script running on BFDS.
The credentials.php has to be filled but never commited to the git
@@ -0,0 +1,83 @@
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$zipfile = "dumps.zip";
if (isset($_GET['cleanup_dump']) && $_GET['cleanup_dump'] == 1)
{
Cleanup();
die("Cleanup done");
}
$dumps_path = 'dumps/';
if(file_exists($dumps_path))
{
array_map( 'unlink', array_filter((array) glob($dumps_path.'*') ) );
}
else
{
mkdir('dumps');
}
//read php file with credentials and parse it
fopen("credentials.php", "r") or die("Unable to open file!");
include 'credentials.php';
//should priovide the following variables:
// $db_host = 'host';
// $db_user = 'user';
// $db_pass = 'pw';
if ($db_host == NULL || $db_user == NULL || $db_pass == NULL) {
die("Please provide credentials in credentials.php");
}
$db_conn = new mysqli($db_host, $db_user, $db_pass);
$result = mysqli_query($db_conn,"SHOW DATABASES");
while ($row = mysqli_fetch_array($result)) {
if($row[0] == 'information_schema' || $row[0] == 'performance_schema')
{
continue;
}
$database = $row[0];
$dir = dirname(__FILE__) . '/'.$dumps_path.$database.'.sql';
exec("mysqldump --user={$db_user} --password={$db_pass} --host={$db_host} {$database} --result-file={$dir} 2>&1", $output);
if(!empty($output))
{
var_dump($output);
}
}
## Zip all dumps
Cleanup($zipfile);
$zip = new ZipArchive;
if($zip -> open($zipfile, ZipArchive::CREATE ) === TRUE)
{
$dir = opendir($dumps_path);
while($file = readdir($dir)) {
if(is_file($dumps_path.$file)) {
$zip -> addFile($dumps_path.$file, $file);
}
}
$zip ->close();
}
//eine funktion die auf den url parameter cleanup_dump=1 reagiert und dann alle dumps löscht
function Cleanup()
{
global $zipfile;
if(file_exists($zipfile))
{
unlink($zipfile);
}
}
+4
View File
@@ -0,0 +1,4 @@
bfds soll sich regelmässig eine copy des wikis und aller scripte auf boogedev.net (uberspace) holen
Um keine hindernden Passwort-Eingaben zu haben, wird ein dezediertes keyfile ohne PW verwendet.
+22
View File
@@ -0,0 +1,22 @@
#!/bin/sh
echo "
nixOS - Befehle
Zeige alle verfügbaren Pakete
$ nix-env -qaP '*' --description
lsmod -> alle module
lsusb -> alle USB devices
uname -a
Linux nixos 4.4.52 #1-NixOS SMP Sun Feb 26 10:08:29 UTC 2017 x86_64 GNU/Linux
## update die Paketinformationen
$ nix-channel --update nixos
## update alle veralteten Programme
$ nix-env -u '*'
## eine ungewollte Aktion rückgängig machen:
$ nix-env --rollback
"
+103
View File
@@ -0,0 +1,103 @@
#!/bin/sh
echo "Linux Version ($ uname -a / $ cat /proc/version):"
uname -a
echo "------------------------------------
Linux Standardbefehle - /bin/befehle
[Bluetooth]
Fn+F3 => turns on/off Wifi & BT
sudo rfkill list; hcitool dev; sudo hciconfig
sudo hciconfig hci0 down
sudo hciconfig hci0 up
sudo rfkill list
sudo rfkill unblock xx:hci0
[Netzwerk]
sudo route add default gw 172.22.99.4 HQ Router umstellen
sudo iftop live netzverkehr
wavemon netzwerk-stärke usw.
ethstatus grafisch Netzlast anzeigen
netstat -i interface statistiken
netstat -tapen alle Netzwerkverbindungen anzeigen
netstat -r routing tabelle
driftnet unverschlüßelte im WLan anzeigen
modprobe ath9k Netzwerktreiber aktivieren (sudo)
rmmod ath9k Netzwerktreiber deaktivieren (sudo)
default gateway
nmap -sP netz/24 alle PCs im Netz anzeigen (schnell)(ohne -sP = full scan)
sudo arp-scan --interface=wlan0 --localnet Alle IPs im LAN anzeigen
iw list [sudo] WLans anzeigen
iw dev wlan0 link [sudo] Verbindungstatus (noch mehr infos: iw dev wlan0 station dump)
iw dev wlan0 scan [sudo] Umgebung scanen
iw dev wlan0 get power_save Stärke des WLans Moduls beeinflussen
iw wlan0 connect foo [sudo] Zu einem ungesichten Netz verbinden
nmcli connection up id EasyBox-BA8C38 -> Verbindung zu bekanntem WPA Netz
nmcli connection show -active -> WLans anzeigen
[python]
venv env erstellt neues virt env (python3)
virtalenv env erstellt neues virt env (python2.7)
source env/bin/activate benutzt das neue virt env
deactivate verlaesst das virt env wieder
[SVN Grundbefehle]
alle lokalen Änderungen verwerfen
svn revert -R /dir
svn update --force
[diverses]
screencast Laptop ffmpeg -f x11grab -r 8 -s 1366x768 -i :0.0 screencast.mp4
Extract Audio ffmpeg -i xx.mp4 -vn -acodec copy xx.aac
Augen schohnen meine Funktion: red
Augen schohnen redshift -O <desired color temperature in K>
Fenster manager openbox --restart
[System]
htop process manger
ps ax zeigt Informationen über laufende Prozesse an
lsb_release -a Zeigt die Ubuntu Version an (cat /etc/lsb_release tuts auch)
uname -a Kernel-Informationen
whoami Wer bin ich? Ausgabe des Benutzernamens
who Wer ist alles eingeloggt?
id Benutzernamen und Gruppenmitgliedschaften
free Zeigt freien Arbeitsspeicher an
sudo mkfs.exfat /dev/mmcblk0 formatieren der SDKarte mit exFat
sshfs host: /media/host Server im Dateisystem einbinden
fusermount -u .../host Server wieder entfernen
[Datei und Ordner]
pwd das aktuelle Verzeichnis
rmdir leeres Dir löschen
rm -rf [VERZ] alle Dateien und Unterverzeichnisse löschen
du -ch *.txt Platzverbrauch bestimmter Dateien
Platzverbrauch bestimmter Dateien recusiv
find . -type f -name '*.jpg' -exec du -cha {} +
Anzahl bestimmter Dateien
find . -type f -iname '*.jpg' | wc -l
df -h HDD Speicherverbrauch
tar -cvf my.tar <files> Dateien packen
tar -cjf xy.tar.bz2 /xy Archiv mit bzip2 anlegen
tar -xf xy.tar.bz2 Archiv auspacken
[Suchen]
grep -rl "foo" --include=*.php*
suchen nach foo in allen php Dateien recursiv. Option l = nur Dateiname nicht Trefferzeile anzeigen
grep -rlE 'exp1.*exp2|exp2.*exp1' --include="*.tpl"
UND-Verknüpftes grep in allen Dateien des Typs .tpl
find . -type f -name "X" -print0 | xargs -0 grep -i Y
suchen nach [Y] in allen [X]
find . -type f -not -name "*.pdf" -print0 | xargs -0 grep -i stuttgarter
auschließen von pdf und inhalt nach stuttgarter
grep [needle] [file] durchsucht file nach dem Suchbegriff [needle]
find . | grep [DATEI] sucht ausgehend vom aktuellen Verzeichnis nach [DATEI]
locate [DATEI] durchsucht die Locate-Datenbank nach [DATEI]
whereis [PROGRAMM] sucht in den Verzeichnissen der Umgebungsvariablen PATH nach [PROGRAMM]
sdiff -s 2 Dateien diffen, -s nur die Unterschiede zeigen
"
+46
View File
@@ -0,0 +1,46 @@
#!/bin/bash
echo "Linux Standardbefehle
du disk usage - Dateigröße ansehen
mv Datei verschieben
rm Datei löscheen
touch Datei anlegen
mkdir Dir anlegen
rmdir leeres Dir löschen
rm -rf [VERZ] alle Dateien und Unterverzeichnisse löschen
[suchen]
find . | grep [file] sucht ausgehend vom aktuellen Verzeichnis nach [DATEI]
grep [needle] [file] durchsucht file nach dem Suchbegriff [needle]
find . | grep [DATEI] sucht ausgehend vom aktuellen Verzeichnis nach [DATEI]
locate [DATEI] durchsucht die Locate-Datenbank nach [DATEI]
whereis [PROGRAMM] sucht in den Verzeichnissen der Umgebungsvariablen PATH nach [PROGRAMM]
sdiff -s 2 Dateien diffen, -s nur die Unterschiede zeigen
df -h HDD Speicherverbrauch
[Netzwerk]
modprobe ath9k Netzwerktreiber aktivieren (sudo)
rmmod ath9k Netzwerktreiber deaktivieren (sudo)
default gateway route add default gw 172.22.99.4
nmap -sP netz/24 alle PCs im Netz anzeigen (schnell)(ohne -sP = full scan)
iw list [sudo] WLans anzeigen
iw dev wlan0 link [sudo] Verbindungstatus (noch mehr infos: iw dev wlan0 station dump)
iw dev wlan0 scan [sudo] Umgebung scanen
iw dev wlan0 get power_save Stärke des WLans Moduls beeinflussen
iw wlan0 connect foo [sudo] Zu einem ungesichten Netz verbinden
nmcli connection show -active -> WLans anzeigen
-------
du -ch *.txt Dateigrößen zusammenzählen
tar -cvf my.tar <files> Dateien packen
htop process manger
ps ax zeigt Informationen über laufende Prozesse an
lsb_release -a Zeigt die Ubuntu Version an (cat /etc/lsb_release tuts auch)
uname -a Kernel-Informationen
whoami Wer bin ich? Ausgabe des Benutzernamens
who Wer ist alles eingeloggt?
id Benutzernamen und Gruppenmitgliedschaften
------
rsync2openelec.sh spiegelt /home/rob auf openelec/xbmc (PW: openelec)
ls -l /proc/$(pidof awesome)/fd/2 - show awesome errors
"
View File
Whitespace-only changes.
+66
View File
@@ -0,0 +1,66 @@
#!/bin/bash
echo "Linux Standardbefehle - /bin/befehle
pwd das aktuelle Verzeichnis
mv Datei verschieben
rm Datei löscheen
touch Datei anlegen
mkdir Dir anlegen
rmdir leeres Dir löschen
rm -rf [VERZ] alle Dateien und Unterverzeichnisse löschen
du disk usage - Dateigröße ansehen
du -ch *.txt Dateigrößen zusammenzählen
df -h HDD Speicherverbrauch
tar -cvf my.tar <files> Dateien packen
[Suchen]
find . -type f -name "X" -print0 | xargs -0 grep -i Y
suchen nach [Y] in allen [X]
find . -type f -not -name "*.pdf" -print0 | xargs -0 grep -i stuttgarter
auschließen von pdf und inhalt nach stuttgarter
grep [needle] [file] durchsucht file nach dem Suchbegriff [needle]
find . | grep [DATEI] sucht ausgehend vom aktuellen Verzeichnis nach [DATEI]
locate [DATEI] durchsucht die Locate-Datenbank nach [DATEI]
whereis [PROGRAMM] sucht in den Verzeichnissen der Umgebungsvariablen PATH nach [PROGRAMM]
sdiff -s 2 Dateien diffen, -s nur die Unterschiede zeigen
[Netzwerk]
sudo route add default gw 172.22.99.4 -> HQ Router umstellen
sudo iftop live netzverkehr
wavemon netzwerk-stärke usw.
ethstatus grafisch Netzlast anzeigen
netstat -i interface statistiken
netstat -tapen alle Netzwerkverbindungen anzeigen
netstat -r routing tabellen
modprobe ath9k Netzwerktreiber aktivieren (sudo)
rmmod ath9k Netzwerktreiber deaktivieren (sudo)
default gateway route add default gw 172.22.99.4
nmap -sP netz/24 alle PCs im Netz anzeigen (schnell)(ohne -sP = full scan)
iw list [sudo] WLans anzeigen
iw dev wlan0 link [sudo] Verbindungstatus (noch mehr infos: iw dev wlan0 station dump)
iw dev wlan0 scan [sudo] Umgebung scanen
iw dev wlan0 get power_save Stärke des WLans Moduls beeinflussen
iw wlan0 connect foo [sudo] Zu einem ungesichten Netz verbinden
nmcli connection up id EasyBox-BA8C38 -> Verbindung zu bekanntem WPA Netz
nmcli connection show -active -> WLans anzeigen
[System]
htop process manger
ps ax zeigt Informationen über laufende Prozesse an
lsb_release -a Zeigt die Ubuntu Version an (cat /etc/lsb_release tuts auch)
uname -a Kernel-Informationen
whoami Wer bin ich? Ausgabe des Benutzernamens
who Wer ist alles eingeloggt?
id Benutzernamen und Gruppenmitgliedschaften
free Zeigt freien Arbeitsspeicher an
sudo mkfs.exfat /dev/mmcblk0 formatieren der SDKarte mit exFat
rsync2openelec.sh spiegelt /home/rob auf openelec/xbmc (PW: openelec)
ls -l /proc/$(pidof awesome)/fd/2 - show awesome errors
foo
"
Executable
+58
View File
@@ -0,0 +1,58 @@
#!/bin/bash
# HDMI Mnitor dunkler machen
uservalue=$1
echo Helligkeit [0-9]: $uservalue
if [ $uservalue ]
then
echo "xrandr --output HDMI-1 --brightness 0.$uservalue"
xrandr --output HDMI-1 --brightness "0.$uservalue"
xrandr --output LVDS-1 --brightness "0.$uservalue"
else
#Erst den aktuellen wert ermitteln
xrandr=`xrandr --verbose | grep Brightness: | tr '\n' ' ' | tr -d ' '| tr -d '\t'`
xrandr=${xrandr:25}
## Achtung, das hier sind nur Stringvergleiche, keine Fließkommaberechnung!
if [[ $xrandr = 1.0 ]]
then
echo "xrandr --output HDMI-1 --brightness 0.9"
xrandr --output HDMI-1 --brightness 0.9
fi
if [[ $xrandr = 0.90 ]]
then
echo "xrandr --output HDMI-1 --brightness 0.80"
xrandr --output HDMI-1 --brightness 0.80
fi
if [[ $xrandr = 0.80 ]]
then
echo "xrandr --output HDMI-1 --brightness 0.70"
xrandr --output HDMI-1 --brightness 0.70
fi
if [[ $xrandr = 0.70 ]]
then
echo "xrandr --output HDMI-1 --brightness 0.60"
xrandr --output HDMI-1 --brightness 0.60
fi
if [[ $xrandr = 0.60 ]]
then
echo "xrandr --output HDMI-1 --brightness 0.50"
xrandr --output HDMI-1 --brightness 0.50
fi
if [[ $xrandr = 0.50 ]]
then
echo "xrandr --output HDMI-1 --brightness 0.40"
xrandr --output HDMI-1 --brightness 0.40
fi
if [[ $xrandr = 0.40 ]]
then
echo "xrandr --output HDMI-1 --brightness 1.0"
xrandr --output HDMI-1 --brightness 1.0
fi
#Laptop display bleibt unberührt
#xrandr --output LVDS-1 --brightness 1
fi
+9
View File
@@ -0,0 +1,9 @@
#!/bin/sh
echo "
cd /home/rob/code/c3d2/c3d2-web
git pull
geany content/events.xml &
make
firefox build/calendar.html
git push
"
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
cat ~/.ssh/<keyfile>.pub | ssh <server> 'mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && echo "Key copied"'
+1
View File
@@ -0,0 +1 @@
/home/rob/code/lokale-scripte/brg.sh
+3
View File
@@ -0,0 +1,3 @@
#/bin/sh
#the config will be tryed to read from $XDG_CONFIG_HOME/feh/, which (when XDG_CONFIG_HOME is unset) defaults to ~/.config/feh/.
feh --auto-zoom --auto-rotate --borderless --geometry=200x200 --randomize --recursive --slideshow-delay=1 "/home/rob/Bilder/Laura Photos/"
+19
View File
@@ -0,0 +1,19 @@
#! /bin/bash
export DISPLAY=:0
export XAUTHORITY=/home/rob/.Xauthority
function connect(){
#echo "HDMI angesteckt" >> /home/rob/hdmi1.txt
#xrandr --output HDMI1 --above LVDS1 --preferred --primary --output LVDS1 --preferred
xrandr --output HDMI1 --mode 1920x1080 --pos 0x0 --primary --output LVDS1 --preferred --mode 1366x768 --pos 274x1080
}
function disconnect(){
#echo "HDMI rausgezogen" >> /home/rob/hdmi1.txt
xrandr --output HDMI1 --off
xrandr --output LVDS1 --preferred --mode 1366x768
}
xrandr | grep "HDMI1 connected" &> /dev/null && connect || disconnect
+1
View File
@@ -0,0 +1 @@
gnome-desktop-item-edit ~/.local/share/applications --create-new
+19
View File
@@ -0,0 +1,19 @@
#!/bin/sh
if [[ ${1} = "on" ]]; then
printf "\nAktiviere ipv6. $ sudo sysctl -w net.ipv6.conf...\n"
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
else
#diabale ipv6
printf "\nDeaktiviere ipv6. $ sudo sysctl -w net.ipv6.conf...\n"
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
fi
#make it more persitant
#disable:
#sysctl -w net.ipv6.conf.default.disable_ipv6=1
#To re-enable IPv6, issue the following commands:
#sysctl -w net.ipv6.conf.default.disable_ipv6=0
+7
View File
@@ -0,0 +1,7 @@
#!/bin/sh
# https://bbs.archlinux.org/viewtopic.php?id=79386
xscreensaver-command -exit
xscreensaver &
xscreensaver-command -lock
+5
View File
@@ -0,0 +1,5 @@
fusermount -u /media/www.ofen-solar.de
curlftpfs -o allow_other vhost1542:stzS4w@adcl1107684.tricoma-netzwerk.de /media/www.ofen-solar.de/
watch -n 59 ping -c4 boogiedev.net >> /media/www.ofen-solar.de/html/keepalive.ftp
+4
View File
@@ -0,0 +1,4 @@
#/bin/bash
WID=`xdotool search "Mozilla Firefox" | head -1`
xdotool windowactivate $WID
xdotool type password
+17
View File
@@ -0,0 +1,17 @@
#!/bin/sh
# aktuell wirds zwar nicht mehr dunkler bei jedem ausführen, dafür ändert es aber auch nicht den Rotanteil
redshiftflag="/home/rob/code/lokale-scripte/redshift_on"
if [ -f $redshiftflag ]
then
echo redshift -oPO 5700
redshift -oPO 5700
# xrandr --output LVDS-1 --brightness 1
rm $redshiftflag
else
echo redshift -oPO 3600
redshift -oPO 3600
# xrandr --output LVDS-1 --brightness 1
echo "diese datei ist da um zu zeigen ob der bildschirm schon rot ist" > $redshiftflag
fi
Executable
+30
View File
@@ -0,0 +1,30 @@
#!/bin/sh
echo '
Character classes
. any character except newline
\w \d \s word, digit, whitespace
\W \D \S not word, digit, whitespace
[abc] any of a, b, or c
[^abc] not a, b, or c
[a-g] character between a & g
Anchors
^abc$ start / end of the string
\\b \\B word, not-word boundary
Escaped characters
\. \* \\ escaped special characters
\\t \\n \\r tab, linefeed, carriage return
\u00A9 unicode escaped ©
Groups and Lookaround
(abc) capture group
\\1 backreference to group #1
(?:abc) non-capturing group
(?=abc) positive lookahead
(?!abc) negative lookahead
Quantifiers & Alternation
a* a+ a? 0 or more, 1 or more, 0 or 1
a{5} a{2,} exactly five, two or more
a{1,3} between one & three
a+? a{2,}? match as few as possible
ab|cd match ab or cd
'
+21
View File
@@ -0,0 +1,21 @@
#!/bin/sh
# Hint: to exclude any directory (for example an cache dir)
# place the CACHEDIR.TAG file in there: https://bford.info/cachedir/
# don't forget the signature in there and set the parameter: --exclude-caches
export RESTIC_REPOSITORY=bfds:/mnt/bfds/rob-restic-backups/restic-repo-t520-user
export RESTIC_PASSWORD=kopenhagenhatsuperinternetwirklich
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# backup the whole user dir to bfds
#restic -r sftp:${RESTIC_REPOSITORY} backup /home/rob --exclude-caches --exclude-file=${SCRIPT_DIR}/backup.excludes
# find files in backup. $1 is the parameter from comand line.
# example: $ backup-list-files.sh /home/rob/Pictures > output.txt
# find all files containing Pictures path and out into output.txt
restic -r sftp:${RESTIC_REPOSITORY} find $1
#restic -r sftp:bfds:/mnt/bfds/rob-restic-backups/restic-repo-t520-user backup /home/rob --exclude-caches
+16
View File
@@ -0,0 +1,16 @@
#!/bin/sh
# Hint: to exclude any directory (for example an cache dir)
# place the CACHEDIR.TAG file in there: https://bford.info/cachedir/
# don't forget the signature in there and set the parameter: --exclude-caches
export RESTIC_REPOSITORY=bfds:/mnt/bfds/rob-restic-backups/restic-repo-t520-user
export RESTIC_PASSWORD=kopenhagenhatsuperinternetwirklich
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# backup the whole user dir to bfds
# restic -r sftp:${RESTIC_REPOSITORY} backup /home/rob --exclude-caches --exclude-file=${SCRIPT_DIR}/backup.excludes
#restic stats -r sftp:${RESTIC_REPOSITORY}
restic snapshots -r sftp:${RESTIC_REPOSITORY}
+21
View File
@@ -0,0 +1,21 @@
#Just Caches
**/.cache/
**/cache/
**/Cache/
#Logs
**/log/
**/logs/
**/Log/
**/Logs/
*.log
# VSCode
/home/rob/.config/Code/Cache
/home/rob/.config/Code/CachedData
/home/rob/.config/Code/CachedExtensions
/home/rob/.config/Code/CachedExtensionVSIXs
# Firefox und Co.
/home/rob/.mozilla
/home/rob/Downloads
+16
View File
@@ -0,0 +1,16 @@
#!/bin/sh
# Hint: to exclude any directory (for example an cache dir)
# place the CACHEDIR.TAG file in there: https://bford.info/cachedir/
# don't forget the signature in there and set the parameter: --exclude-caches
export RESTIC_REPOSITORY=bfds:/mnt/bfds/rob-restic-backups/restic-repo-t520-user
export RESTIC_PASSWORD=kopenhagenhatsuperinternetwirklich
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# backup the whole user dir to bfds
restic -r sftp:${RESTIC_REPOSITORY} backup /home/rob --exclude-caches --exclude-file=${SCRIPT_DIR}/backup.excludes
#restic -r sftp:bfds:/mnt/bfds/rob-restic-backups/restic-repo-t520-user backup /home/rob --exclude-caches
+12
View File
@@ -0,0 +1,12 @@
#!/bin/sh
# mount the backup into the file system
MOUNTPOINT="/mnt/restic-backup-me"
echo Erstelle Ordner $MOUNTPOINT via sudo
sudo mkdir $MOUNTPOINT
sudo chown rob:rob $MOUNTPOINT
echo Mount Backup
./restic-bfds.sh mount $MOUNTPOINT
+13
View File
@@ -0,0 +1,13 @@
#!/bin/sh
# Hint: to exclude any directory (for example an cache dir)
# place the CACHEDIR.TAG file in there: https://bford.info/cachedir/
# don't forget the signature in there and set the parameter: --exclude-caches
export RESTIC_REPOSITORY=bfds:/mnt/bfds/rob-restic-backups/restic-repo-t520-user
export RESTIC_PASSWORD=kopenhagenhatsuperinternetwirklich
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# restic wrapper for use with command line arguments
restic -r sftp:${RESTIC_REPOSITORY} $1 $2 $3 $4 $5 $6 $7 $8 $9
+5
View File
@@ -0,0 +1,5 @@
#!/bin/sh
INCLUDE_FILES="/home/rob/Pictures/2022/*"
RESTORE_PATH="/home/rob/Pictures/from_restic/"
./restic-bfds.sh restore --target "$RESTORE_PATH" --include "$INCLUDE_FILES" latest
+7
View File
@@ -0,0 +1,7 @@
backup_all_databases_cMxNrCTVLBPrNo6qaonojeejCvCepekwssh
nextcloud/config/config.php
nextcloud/data/root/files/Extern
nextcloud/updater
nextcloud/backup
/nextcloud-data/updater-*/
files_trashbin/
+3
View File
@@ -0,0 +1,3 @@
This folder hast to be on the SBZ server
The credentials.php has to be filled but never commited to the git
@@ -0,0 +1,58 @@
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$dumps_path = 'dumps/';
if(file_exists($dumps_path))
{
array_map( 'unlink', array_filter((array) glob($dumps_path.'*') ) );
}
else
{
mkdir('dumps');
}
$host = 'localhost';
$user = 'root';
$pass = "AdfQ3prfUDPu2MtaoLFtxvWbdBooJ6";
$db_conn = new mysqli($host, $user, $pass);
$result = mysqli_query($db_conn,"SHOW DATABASES");
while ($row = mysqli_fetch_array($result)) {
if($row[0] == 'information_schema' || $row[0] == 'performance_schema')
{
continue;
}
$database = $row[0];
$dir = dirname(__FILE__) . '/'.$dumps_path.$database.'.sql';
exec("mysqldump --user={$user} --password={$pass} --host={$host} {$database} --result-file={$dir} 2>&1", $output);
if(!empty($output))
{
var_dump($output);
}
}
## Zip all dumps
$zipfile = "dumps.zip";
if(file_exists($zipfile))
{
unlink($zipfile);
}
$zip = new ZipArchive;
if($zip -> open($zipfile, ZipArchive::CREATE ) === TRUE)
{
$dir = opendir($dumps_path);
while($file = readdir($dir)) {
if(is_file($dumps_path.$file)) {
$zip -> addFile($dumps_path.$file, $file);
}
}
$zip ->close();
}
+7
View File
@@ -0,0 +1,7 @@
bfds soll sich regelmässig eine copy der nextcloud instanz ziehen
Dazu wird der home-rob container im /home/rob gemountet und dann auf file basis eine Kopie vom kompletten /var/www/html
Nextcloud wird zu dem dazu in den maintenance mode versetzt.
Um keoine Passwort-Eingaben zu verhindern, wird ein dezediertes keyfile ohne PW verwendet.
+69
View File
@@ -0,0 +1,69 @@
#!/bin/sh
# this one makes a copy of the whole /var/www/html from sbz
#
# to recover nextcloud data see: https://docs.nextcloud.com/server/13/admin_manual/maintenance/restore.html
#
# rsync args:
# -a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)
# -r, --recursive recurse into directories
# -l, --links When symlinks are encountered, recreate the symlink on the destination.
# -h, --human-readable Output numbers in a more human-readable format.
SCRIPTPATH=$(dirname `realpath $0`)
cd $SCRIPTPATH
# rsync source -> destination
SOURCE_PATH=/var/www/
DEST_PATH_FILES=/mnt/bfds/rob/backup/server/spaceboyz.net/var_www
# ssh credentials
PORT="42523"
KEY="${SCRIPTPATH}/sbz_keyless"
USER_AT_HOST="rob@spaceboyz.net"
# path of the database backups
DEST_PATH_DB=/mnt/bfds/rob/backup/server/spaceboyz.net/mariadb
## path where home-rob container is mouted into host (on SBZ)
SBZ_MOUNT_PATH=/home/rob/tmp_mnt
## path of the nextcloud instance (on SBZ)
NEXTCLOUD_PATH=/var/www/html/nextcloud
EXCLUDE="--exclude-from exclude-list"
# mount my lxc container into my home on sbz
ssh -p $PORT -i $KEY $USER_AT_HOST "sudo mount /dev/mapper/vms-home--rob $SBZ_MOUNT_PATH"
# grand read permissons if not given
ssh -p $PORT -i $KEY $USER_AT_HOST "sudo chmod -R +rx ${SBZ_MOUNT_PATH}/var/www/nextcloud-data"
# put nextcloud into maintenance, outside the home-rob container
ssh -p $PORT -i $KEY $USER_AT_HOST "sudo sed -i \"s|'maintenance' => false|'maintenance' => true|g\" $SBZ_MOUNT_PATH$NEXTCLOUD_PATH/config/config.php"
# rsync download from sbz
rsync --quiet -a -zz --progress $EXCLUDE -e "ssh -p $PORT -i $KEY" $USER_AT_HOST:${SBZ_MOUNT_PATH}${SOURCE_PATH} ${DEST_PATH_FILES}
# turn off nextcloud maintenancThis rsync lacks old-style --compress due to its external zlibe, outside the home-rob container
ssh -p $PORT -i $KEY $USER_AT_HOST "sudo sed -i \"s|'maintenance' => true|'maintenance' => false|g\" $SBZ_MOUNT_PATH$NEXTCLOUD_PATH/config/config.php"
# umount my container
ssh -p $PORT -i $KEY $USER_AT_HOST "sudo umount $SBZ_MOUNT_PATH"
### Get all databases
cd $DEST_PATH_DB
# kick off DB dumping
curl --insecure --silent https://rob.spaceboyz.net/backup_all_databases_cMxNrCTVLBPrNo6qaonojeejCvCepekwssh/dump_all_databases.php
# download DB dumps
curl --insecure --silent https://rob.spaceboyz.net/backup_all_databases_cMxNrCTVLBPrNo6qaonojeejCvCepekwssh/dumps.zip > dumps.zip
if [ -f dumps.zip ]
then
today=`date +%F`
mv dumps.zip all_databases_dump_$today.zip
else
echo "Datenbank Dump konnte nicht herunter geladen werden"
fi
+49
View File
@@ -0,0 +1,49 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAACFwAAAAdzc2gtcn
NhAAAAAwEAAQAAAgEAq1upoPN1v3HULmgfxtJI1d600VL++rF705csmrpYukoxLHpn3g6F
UwwLD1F7uqpfmingCBO9HW6vLmHZrtIcGb1BzVXMCyiFfb076HjAQHzV/NWk8PpKF32ekk
ejFvL2jSvm+HlGL02uG0uxcK1FzIEFd5pZ1KTyxoEvtCuO4ndYcscDqJc2y7Rk3UdbnFcx
PmYrR7d1Z+vwCdSiVdvkxUmWVyoVKe5YnR8K0LdsdJ/85EPwVvPrC+W+/9huJFC/vjnxfp
2Y0BhWYJ1SFNvH5itYs5GLZ4tj2D80XrMvK93gMK6r+f/MOxaiNy8dgZAR8SmVN7BDsFeG
OQQWQAr+M5N/VUyQ2s+eQLH+4PnAjhWNM6q/7GFnpNM5Tz9nHLPYIuYB/6C3iywgTxgoHn
x+ms/Kn8Lw7voDdLoFKOGh+B31hM2aUuZJcdxddrccVedeGdUSksbyJrgoNN0mLzF9XJbr
rGztrkY/VSdFZwPYPlIhJv1CX/RoAeOdH1xHIyVMlMkPHhcg+0zyCgcwsb9Bg3JSisyXnl
G3xpMUKHJKZd4XtXCCEn8qMTxE8s08CM/yzkLEnDKQuFva9cnNDCXDcvHtCuofwcHr+rRK
ldKiB87+W541XQ5CmxDDCey2g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fyoxPETyzTwIz/LOQsScMpC4W9r1yc0MJcNy8e0K6h/Bwev6tEqV0qIHzv5bnjVdDkKbEMMJ7LaBeUQstgJ4w3tgVxN6QgvTesDCRg4oWuqb5d82eAvl/9k+dQ== rob@d3v.localdomain
+8
View File
@@ -0,0 +1,8 @@
#!/bin/sh
# für tmux powerline
# zeigt nur den noch freien Specher in human readable und percent an für Daten und Programme
df_root=`df /boot -h --output=avail,pcent | tail -n 1`
df_home=`df /home -h --output=avail,pcent | tail -n 1`
echo [root$df_root][home$df_home]
+39
View File
@@ -0,0 +1,39 @@
#sessions: immer nur eine pro host also
# - 0 local
# Windows (tabs)
# -tmux
# - panes: manpage, conf, testzeile
# - local updates
# - symfonyBook
# - ofenSolar
# - 1 boogie
# - 2 nulli
# - 3 spaceboyz
### Das script ist nur um meine default Session zu erzeugen.
### es darf nicht automatisch oder bei jedem tmux start gefahren werden
### des es zusätzliche Sessions erzeugt
#Window 0: tmux info
tmux new-session -d
tmux rename-session -t 0 prism
#tmux split-window -v 'nano /home/rob/code/lokale-scripte/tmux_layout.sh'
#tmux split-window -h 'nano /home/rob/.tmux.conf'
#Window 1: system changes/updates
tmux new-window -n 'updates' 'echo "herzlich willkommen"'
#Window 1: lokale Dinge
tmux new-window -n 'local' -d
tmux new-window -n 'code' -d
#Window 9: i'am in the club
tmux new-window -n 'c3d2' -d
#remotes
tmux new-window -n 'uberspace' -d
tmux new-window -n 'sbz' -d
tmux new-window -n 'bfds' -d
tmux attach-session -t prism
+13
View File
@@ -0,0 +1,13 @@
#!/bin/sh
uservalue=$1
trackpad_device_id=16
if [ $uservalue ]
then
echo "xinput --enable $trackpad_device_id"
xinput --enable $trackpad_device_id
else
echo "xinput --disable $trackpad_device_id"
xinput --disable $trackpad_device_id
fi
+69
View File
@@ -0,0 +1,69 @@
#/bin/bash
echo "Step one: update everything"
echo "==========================="
echo ""
read -n1 -s -r -p $'run now: $sudo dnf upgrade --refresh (Enter = run)' key
if [ "$key" = "" ]; then
sudo dnf upgrade --refresh
read -n1 -s -r -p $'and reboot your computer now! (Enter = reboot)' key
if [ "$key" = "" ]; then
reboot
fi
fi
echo ""
echo ""
echo "Step two: install dnf-plugin-system-upgrade"
echo "==========================================="
echo ""
read -n1 -s -r -p $'run now: $sudo dnf install dnf-plugin-system-upgrade (Enter = run)' key
if [ "$key" = "" ]; then
sudo dnf install dnf-plugin-system-upgrade
fi
## get actual version in variable $VERSION_ID
source /etc/os-release
let NEXT_VERSION=$VERSION_ID+1
echo ""
echo ""
echo "Step three: system-upgrade download Version $NEXT_VERSION"
echo "==================================================="
echo ""
read -n1 -s -r -p $"run now: sudo dnf system-upgrade download --releasever=$NEXT_VERSION (Enter = run)" key
if [ "$key" = "" ]; then
sudo dnf system-upgrade download --releasever=$NEXT_VERSION
fi
echo ""
echo ""
echo "Step four: start the upgrade"
echo "============================"
echo ""
read -n1 -s -r -p $'run now: dnf system-upgrade reboot (Enter = run)' key
if [ "$key" = "" ]; then
sudo dnf system-upgrade reboot
fi
echo ""
echo ""
echo "Step five: clean the upgrade"
echo "============================"
echo ""
read -n1 -s -r -p $'run now: dnf system-upgrade clean (Enter = run)' key
if [ "$key" = "" ]; then
sudo dnf system-upgrade clean && dnf clean packages
fi
+3
View File
@@ -0,0 +1,3 @@
#/bin/zsh
echo "Internes WLan-Modul wird deaktiviert."
sudo rmmod ath9k
+3
View File
@@ -0,0 +1,3 @@
#/bin/zsh
echo "Internes WLan-Modul wird aktiviert"
sudo modprobe ath9k