Added initial code.

This commit is contained in:
eplots 2024-07-03 21:06:41 +02:00
parent b20c62c46e
commit aa8e08afca
27 changed files with 565 additions and 8 deletions

26
bash/deploy-hugo.sh Normal file
View file

@ -0,0 +1,26 @@
#!/usr/bin/env bash
echo 'Checking if Hugo Docker development server is running...'
echo 'If nothing happens after this, start the development server using:'
echo 'docker run -p 1313:1313 --rm -v /opt/containers/hugo/site/:/src --name hugo klakegg/hugo:0.111-3-ext-alpine server'
if [ -n "$(docker ps -f "name=hugo" -f "status=running" -q )" ]; then
while true; do
read -p "Do you want to build the website? " yn
case $yn in
[Yy]* ) docker exec -it hugo hugo build; break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
while true; do
read -p "Do you want to upload the website? " yn
case $yn in
[Yy]* ) scp -q -r /opt/containers/hugo/site/public/* websrv:/home/eplots/eplots.xyz/blog/static/; break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
echo "Done!"
fi

4
bash/reset-websrv.sh Normal file
View file

@ -0,0 +1,4 @@
#!/usr/bin/env bash
# One-liner to reset websrv
sed -i '/^185.193.125.246/ d' ~/.ssh/known_hosts && cat ~/.ssh/websrv.pub | xclip -sel c

3
bash/sb-vpn Normal file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
ip -o -4 a show tun0 | awk '/inet 10\./ {print $4}' | cut -d'/' -f1

10
bash/scp-dir.sh Normal file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
# Store destination paths in variables
nasty="eplots@192.168.50.212:~/NASty/hackz"
# Parse directory path to get directory name only and store it in a variable
dir="$(basename $2)"
# If $1 variable equals "NASty", format SCP to copy dir ($2) to NASty:
[ "$1" == nasty ] && scp -P 1886 -r "$2" "$nasty"/"$dir"

10
bash/scp-file.sh Normal file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
# Store destination path in variable
nasty="eplots@192.168.50.212:~/NASty/hackz"
# Parse filepath to get filename only and store in variable
file="$(basename $2)"
# If $1 variable equals "nasty", format SCP to copy file ($2) to NASty:
[ "$1" == nasty ] && scp -P 1886 "$2" "$nasty"/"$file"

4
bash/webp.sh Normal file
View file

@ -0,0 +1,4 @@
#!/usr/bin/env bash
# One-liner to convert all *.png to *.webp
for x in ls *.png; do cwebp -q 80 $x -o ${x%.png}.webp; done