remove old serverhost scripts

This commit is contained in:
lucas committed 2026-10-24 20:11:28 +02:00
1 parent 2ec34dd1be
commit 7e7a8c3af5
26 files changed
-691

No files matched your search

Binary file not shown.
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
while true; do B=$(du -d1 /backup/DataRescue/ | tail -n1 | cut -f1); F=$(du -d1 /media/lucas/LucasFestplatte/ | tail -n1 | cut -f1); sleep 2; clear; echo "print ${F} / ${B} * 100" | perl; done
+9
View File
@@ -0,0 +1,9 @@
#!/bin/bash
>/home/lucas/arduinoOut.txt
while true # loop forever
do
date >> /home/lucas/arduinoOut.txt
data=$(cat /dev/ttyACM0 | head -n 20 | tail -n 20)
printf "$data" >> /home/lucas/arduinoOut.txt
#printf "$(date)\n$data\n"
done
+227
View File
@@ -0,0 +1,227 @@
#!/bin/bash
CUR_DIR=$(pwd)
THEMES_PROJECT_FOLDER="/home/lucas/Documents/Dokumente/Projekte/Handy/ThemeProject"
UNZIP=false
BUILD=false
FIND=false
FONT="DroidSans"
BUILD_NC_THEME=false
THEME_NAME="SolarSystemTheme"
usage() {
printf "Usage:
-build\t\tBuild the Theme
-build_NC\t\tBuild the NextCloud Theme
-unzip\t\tUnzip com.* folders in the Theme Project Folder
-name <name>\tAlternate Theme Name(Default: SolarSystemTheme)
-font <name>
-f <arg>\tFind arg in Theme Files
-p <path>\tPath of the Theme Project Folder(default: quiethost path)
-h\t\tDisplay Usage
-help\tDisplay Usage\n"
}
get_config() {
while [[ ${1:0:1} == - ]]; do
echo "Param: $1"
[[ $1 == -build ]] && {
BUILD=true
shift 1;
continue;
};
[[ $1 == -build_NC ]] && {
BUILD_NC_THEME=true
shift 1;
continue;
};
[[ $1 == -name ]] && {
if [ "$2" == "" ]; then echo "Too few arguments"; usage; exit; fi
THEME_NAME="$2"
shift 2;
continue;
};
[[ $1 == -font ]] && {
FIND=true
if [ "$2" == "" ]; then echo "Too few arguments"; usage; exit; fi
FONT="$(echo $2 | sed 's/.ttf//g')"
shift 2;
continue;
};
[[ $1 == -f ]] && {
FIND=true
if [ "$2" == "" ]; then echo "Too few arguments"; usage; exit; fi
FIND_arg="$2"
shift 2;
continue;
};
[[ $1 == -p ]] && {
if [ "$2" == "" ]; then
printf "Too few arguments\nPath: ${THEMES_PROJECT_FOLDER}\n"
shift 1
continue
fi
THEMES_PROJECT_FOLDER="$2"
shift 2;
continue;
};
[[ $1 == -unzip ]] && {
UNZIP=true
shift 1;
continue;
};
[[ $1 == -help ]] && {
usage
exit
};
echo "Parameter $1 discarded"
usage
shift 1;
done
}
build_theme() {
date=$(date +"%m%d%H%M%S")
if [ -d ".${THEME_NAME}_BUFF" ]; then
rm -dr .${THEME_NAME}_BUFF
fi
mkdir .${THEME_NAME}_BUFF
echo "${CUR_DIR}"
echo "Contacts Background"
ICON_str="${THEME_NAME}/ContactsBG/ContactsBG"
if [ -d "${THEME_NAME}/ContactsBG" ]; then
if [ "$(ls ${ICON_str}*png)" != "" ]; then
echo "Choose random Contacts Background"
RAND_NUM=$(($RANDOM % $(ls ${THEME_NAME}/ContactsBG/*png | wc -l) + 1 ))
echo "${ICON_str}${RAND_NUM}.png"
cp ${ICON_str}${RAND_NUM}.png ${THEME_NAME}/com.android.contacts/res/drawable-xxhdpi/contact_detail_list_background.9.png
cp ${ICON_str}${RAND_NUM}.png ${THEME_NAME}/framework-res-hwext/res/drawable-xxhdpi/background_emui.9.png
fi
fi
for folder in $(ls -d ${THEME_NAME}/com.*); do
folder="$(echo "${folder}" | rev | cut -f1 -d'/' | rev)"
echo ${folder}
if [ -d ".${THEME_NAME}_BUFF/${folder}" ]; then
rm -dr .${THEME_NAME}_BUFF/${folder}
fi
cp -r ${THEME_NAME}/framework-res-hwext ${THEME_NAME}/${folder}
cd ${THEME_NAME}/${folder}
zip -q -r ${folder} *
mv ${folder} ../../.${THEME_NAME}_BUFF/${folder}
cd ${THEMES_PROJECT_FOLDER}
rm -dr ${THEME_NAME}/${folder}/framework-res-hwext
done
if [ -f ".${THEME_NAME}_BUFF/icons" ]; then
rm .${THEME_NAME}_BUFF/icons
fi
echo "Icons"
ICON=("Toshl" "FoE" "Hangar")
HUAWEI_name=("com.thirdframestudios.android.expensoor.png" "com.innogames.foeandroid.png" "me.calebjones.spacelaunchnow.png")
for (( i=0 ; i<${#ICON[@]} ; i++ )); do
ICON_str="${THEME_NAME}/${ICON[$i]}/${ICON[$i]}"
if [ -d "${THEME_NAME}/${ICON[$i]}" ]; then
if [ "$(ls ${ICON_str}*png)" != "" ]; then
echo "Choose random ${ICON[$i]} Icon"
cp ${ICON_str}$(($RANDOM % $(ls ${ICON_str}*png | wc -l) + 1 )).png ${THEME_NAME}/icons/${HUAWEI_name[$i]}
fi
fi
done
cd ${THEME_NAME}/icons
zip -q -r icons.zip *
mv icons.zip ../../.${THEME_NAME}_BUFF/icons
cd ${THEMES_PROJECT_FOLDER}
if [ -f "${THEME_NAME}.zip" ]; then
rm ${THEME_NAME}.zip
fi
echo "Preview, Unlock, Wallpaper, font and description.xml"
if [ -f "${THEME_NAME}/fonts/${FONT}.ttf" ]; then
echo "Use font ${FONT}"
mkdir .${THEME_NAME}_BUFF/fonts
cp ${THEME_NAME}/fonts/${FONT}.ttf .${THEME_NAME}_BUFF/fonts/${FONT}Chinese.ttf
else
echo "Font ${RONT} not available"
fi
cp -r ${THEME_NAME}/preview .${THEME_NAME}_BUFF/
cp -r ${THEME_NAME}/unlock .${THEME_NAME}_BUFF/
cp -r ${THEME_NAME}/wallpaper .${THEME_NAME}_BUFF/
cp -r ${THEME_NAME}/description.xml .${THEME_NAME}_BUFF/
cd .${THEME_NAME}_BUFF
echo "Create ${THEME_NAME}_${date}.hwt"
sed -i 's/Theme<\/title/Theme_'"${date}"'<\/title/g' description.xml
zip -q -r ${THEME_NAME}.zip *
cp ${THEME_NAME}.zip ../${THEME_NAME}_${date}.hwt
cd ${THEMES_PROJECT_FOLDER}
echo "Remove Smartphone themecache, .cache and old ${THEME_NAME}s"
if [ "$(find /run/user/$(id -u $(whoami))/gvfs/mtp:host*/Inter*/Huawei/Themes/ -name "${THEME_NAME}*")" != "" ]; then
rm /run/user/$(id -u $(whoami))/gvfs/mtp:host*/Inter*/Huawei/Themes/${THEME_NAME}*
fi
if [ -d /run/user/$(id -u $(whoami))/gvfs/mtp:host*/Inter*/Huawei/Themes/themecache ]; then
rm -dr /run/user/$(id -u $(whoami))/gvfs/mtp:host*/Inter*/Huawei/Themes/themecache
fi
if [ -d /run/user/$(id -u $(whoami))/gvfs/mtp:host*/Inter*/Huawei/Themes/.cache ]; then
rm -dr /run/user/$(id -u $(whoami))/gvfs/mtp:host*/Inter*/Huawei/Themes/.cache
fi
echo "Transfer Theme to Smartphone"
cp --no-preserve=ownership,timestamps ${THEME_NAME}_${date}.hwt /run/user/$(id -u $(whoami))/gvfs/mtp:host*/Inter*/Huawei/Themes/
echo "Move local Theme to NC"
cp ${THEME_NAME}_${date}.hwt ${THEME_NAME}/${THEME_NAME}.hwt
rm -dr .${THEME_NAME}_BUFF
}
unzip_com() {
CUR_DIR="$(pwd)"
rm -dr ${THEME_NAME}/*
unzip ${THEME_NAME}.hwt -d ${THEME_NAME}/
for folder in $(ls -d ${THEME_NAME}/com.*); do
folder="$(echo "${folder}" | rev | cut -f1 -d'/' | rev)"
echo ${folder}
if [ -d "${THEME_NAME}/${folder}" ]; then
echo "${folder} is a Directory"
exit
fi
if [ -d "${THEME_NAME}/buf_${folder}" ]; then
rm -dr buf_${folder}
fi
cd ${THEME_NAME}
unzip -q ${folder} -d buf_${folder}
rm ${folder}
if [ -d "buf_${folder}" ];then
mv buf_${folder} ${folder}
fi
if [ -d "${folder}/framework-res-hwext" ];then
cp -r ${folder}/framework-res-hwext framework-res-hwext_${folder}
rm -dr ${folder}/framework-res-hwext
fi
cd ${CUR_DIR}
done
unzip ${THEME_NAME}/icons -d ${THEME_NAME}/icons_buff
rm ${THEME_NAME}/icons
mv ${THEME_NAME}/icons_buff ${THEME_NAME}/icons
}
find_themes() {
grep "${FIND_arg}" -r ${THEME_NAME}/*
}
build_NC_theme() {
NC_THEME_DIR="/home/lucas/Documents/Dokumente/Projekte/Server/serverhost/NextCloudThemes/"
theme_NUM=2
rsync -rlvz --delete ${NC_THEME_DIR}${THEME_NAME}${theme_NUM}/* /nextcloud/nextcloud/themes/${THEME_NAME}/
sudo chown -R www-data /nextcloud/nextcloud/themes/${THEME_NAME}
sudo chgrp -R www-data /nextcloud/nextcloud/themes/${THEME_NAME}
}
sync_image() {
echo "Sync Nextcloud"
if [ $(id -u) -eq 0 ]; then
sudo -u lucas /usr/bin/syncNC -t > /dev/null 2>&1
else
/usr/bin/syncNC -t > /dev/null 2>&1
fi
}
if [ $# -lt 1 ]; then usage; fi
get_config "$@"
echo "Move to ${THEMES_PROJECT_FOLDER}"
sync_image
cd ${THEMES_PROJECT_FOLDER}
if ${BUILD}; then build_theme; fi
if ${UNZIP}; then unzip_com; fi
if ${FIND}; then find_themes; fi
if ${BUILD_NC_THEME}; then build_NC_theme; fi
cd ${CUR_DIR}
sync_image
+113
View File
@@ -0,0 +1,113 @@
#!/bin/bash
SITES=("https://www.fondsprofessionell.at/fonds/details/fondsName/Amundi-Komfort-Invest-traditionell-T/ISIN/AT0000801071/fondsID/FU_80107/"
"https://www.fondsprofessionell.at/fonds/details/ISIN/AT0000A2L443/fondsID/FU_100076607/"
"https://www.fondsprofessionell.at/fonds/details/fondsName/Amundi-CPR-Climate-Action-T/ISIN/AT0000A28YU4/fondsID/FU_100070247/"
"https://www.finanzen.net/index/dow_jones" "https://www.finanzen.net/index/dax" "https://www.finanzen.net/index/atx")
if [ -f /home/lucas/Documents/Dokumente/Projekte/Server/www/BA_Data.html ]; then
BA_JS="/home/lucas/Documents/Dokumente/Projekte/Server/www/data.js"
BA_DATA="/home/lucas/Documents/Dokumente/Projekte/Server/www/BA_Data.html"
else
exit
fi
DEBUG=false
if [ "$1" == "-d" ];then
DEBUG=true
fi
DATE="$(date +"%d.%m.%Y")"
if [ $# -eq 3 ]; then
KURS_INET1="$1"
KURS_INET2="$2"
KURS_INET3="$3"
else
KURS_INET1=""
KURS_INET2=""
KURS_INET3=""
DOWJ=""
DAX=""
GET=true
if ${GET}; then
KURS_INET1=$(wget -qO- ${SITES[0]} | sed 's/<\//\n<\//g' | grep -A2 "NAV am" | grep -o -P '(?<=<td> ).*(?=EUR)' | sed 's/ //g' | sed 's/,/./g')
KURS_INET2=$(wget -qO- ${SITES[1]} | sed 's/<\//\n<\//g' | grep -A2 "NAV am" | grep -o -P '(?<=<td> ).*(?=EUR)' | sed 's/ //g' | sed 's/,/./g')
#KURS_INET2=$(wget -qO- ${SITES[1]} | grep "Rücknahmepreis" | grep -o -P '(?<=right">).*(?=</td>)' | sed 's/,/./g')
KURS_INET3=$(wget -qO- ${SITES[2]} | sed 's/<\//\n<\//g' | grep -A2 "NAV am" | grep -o -P '(?<=<td> ).*(?=EUR)' | sed 's/ //g' | sed 's/,/./g')
DOWJ=$(wget -qO- ${SITES[3]} | sed 's/<tr>/<tr>\n/g' | grep -A3 '<strong>Kurs</strong>' | grep -o -E "[0-9]+\.[0-9]+,[0-9]{2}" | tr -d '.' | tr ',' '.' | tail -1)
DAX=$(wget -qO- ${SITES[4]} | sed 's/<tr>/<tr>\n/g' | grep -A3 '<strong>Kurs</strong>' | grep -o -E "[0-9]+\.[0-9]+,[0-9]{2}" | tr -d '.' | tr ',' '.' | tail -1)
ATX=$(wget -qO- ${SITES[5]} | sed 's/<tr>/<tr>\n/g' | grep -A3 '<strong>Kurs</strong>' | grep -o -E "[0-9]+\.[0-9]+,[0-9]{2}" | tr -d '.' | tr ',' '.' | tail -1)
fi
fi
#if [ "$(cat ${BA_DATA} | grep -F "<td>${DATE}</td>")" == "" ]; then
# if [[ "${KURS_INET1}" != "" ]] && [[ "${KURS_INET2}" != "" ]] && [[ "${KURS_INET3}" != "" ]] && [[ "${DATE}" != "" ]]; then
# sed -i 's/<\/table>/<tr><td>'"${KURS_INET1}"'<\/td><td>'"${KURS_INET2}"'<\/td><td>'"${KURS_INET3}"'<\/td><td>'"${DATE}"'<\/td><\/tr><\/table>/g' ${BA_DATA}
# fi
IFS=$'\n'; set -f
KURSE_INET=("${KURS_INET1}" "${KURS_INET2}" "${KURS_INET3}" "${DOWJ}" "${DAX}" "${ATX}")
KURSE_LOCAL=($(cat ${BA_JS} | grep '.data' | rev | cut -d',' -f 1 | rev | sed 's/\];//g'))
DATE_LOCAL="$(cat ${BA_JS} | grep 'date' | rev | cut -d',' -f 1 | rev | sed 's/\];//g' | tr -d "\'")"
if ${DEBUG}; then
echo "${#KURSE_INET[@]} -eq ${#KURSE_LOCAL[@]}"
fi
ALL_THERE=true
for ((i=0;i<${#KURSE_INET[@]};i++)); do
if [[ "${KURSE_INET[$i]}" == "" ]]; then
ALL_THERE=false
if ${DEBUG}; then
echo "$i: ${KURSE_INET[$i]}"
fi
fi
done
if [[ "${ALL_THERE}" == "true" ]]; then
CHANGE=false
unset IFS; set +f
if ${DEBUG}; then
printf "Inet\t\tLocal\n"
fi
for ((i=0;i<${#KURSE_INET[@]};i++)); do
if ${DEBUG}; then
printf "%s\t\t%s\n" "${KURSE_INET[$i]}" "${KURSE_LOCAL[$i]}"
fi
if [ "${KURSE_INET[$i]}" != "${KURSE_LOCAL[$i]}" ]; then
CHANGE=true
printf "Diff: %s\t\t%s\n" "${KURSE_INET[$i]}" "${KURSE_LOCAL[$i]}"
fi
done
if [[ "${CHANGE}" == "true" ]]; then
if [[ "${DATE}" == "${DATE_LOCAL}" ]]; then
if ${DEBUG}; then echo "Change on same Date"; fi
sed -i 's/<tr><td>'"${KURS_LOCAL[0]}"'<\/td><td>'"${KURS_LOCAL[1]}"'<\/td><td>'"${KURS_LOCAL[2]}"'<\/td><td>'"${DATE}"'<\/td><\/tr>/<tr><td>'"${KURSE_INET[0]}"'<\/td><td>'"${KURSE_INET[1]}"'<\/td><td>'"${KURSE_INET[2]}"'<\/td><td>'"${DATE}"'<\/td><\/tr>/g' ${BA_DATA}
sed -i 's/\(fond_trad\.data.*\),[0-9]\+\.[0-9]\{2\}\];/\1,'"${KURSE_INET[0]}"'];/g' ${BA_JS}
sed -i 's/\(fond_dyn\.data.*\),[0-9]\+\.[0-9]\{2\}\];/\1,'"${KURSE_INET[1]}"'];/g' ${BA_JS}
sed -i 's/\(fond_climate\.data.*\),[0-9]\+\.[0-9]\{2\}\];/\1,'"${KURSE_INET[2]}"'];/g' ${BA_JS}
sed -i 's/\(fond_doj\.data.*\),[0-9]\+\.[0-9]\{2\}\];/\1,'"${KURSE_INET[3]}"'];/g' ${BA_JS}
sed -i 's/\(fond_dax\.data.*\),[0-9]\+\.[0-9]\{2\}\];/\1,'"${KURSE_INET[4]}"'];/g' ${BA_JS}
sed -i 's/\(fond_atx\.data.*\),[0-9]\+\.[0-9]\{2\}\];/\1,'"${KURSE_INET[5]}"'];/g' ${BA_JS}
touch ${BA_DATA}
touch ${BA_JS}
else
if ${DEBUG}; then echo "Change on New Date"; fi
sed -i 's/<\/table>/<tr><td>'"${KURSE_INET[0]}"'<\/td><td>'"${KURSE_INET[1]}"'<\/td><td>'"${KURSE_INET[2]}"'<\/td><td>'"${DATE}"'<\/td><\/tr><\/table>/g' ${BA_DATA}
## data.js ##
sed -i 's/\(fond_trad\.data.*\)\];/\1,'"${KURSE_INET[0]}"'];/g' ${BA_JS}
echo $?
sed -i 's/\(fond_dyn\.data.*\)\];/\1,'"${KURSE_INET[1]}"'];/g' ${BA_JS}
echo $?
sed -i 's/\(fond_climate\.data.*\)\];/\1,'"${KURSE_INET[2]}"'];/g' ${BA_JS}
echo $?
sed -i 's/\(date.*\)\];/\1,'"'${DATE}'"'];/g' ${BA_JS}
echo $?
sed -i 's/\(fond_doj\.data.*\)\];/\1,'"${KURSE_INET[3]}"'];/g' ${BA_JS}
echo $?
sed -i 's/\(fond_dax\.data.*\)\];/\1,'"${KURSE_INET[4]}"'];/g' ${BA_JS}
echo $?
sed -i 's/\(fond_atx\.data.*\)\];/\1,'"${KURSE_INET[5]}"'];/g' ${BA_JS}
echo $?
touch ${BA_DATA}
touch ${BA_JS}
fi
else
if ${DEBUG}; then echo No Change; fi
fi
fi
if [ "$(which syncNC)" != "" ]; then
syncNC > /dev/null 2>&1
fi