From 23a70dc3ece576344603c67ac219b524f7086bca Mon Sep 17 00:00:00 2001 From: jdlugosz963 Date: Wed, 28 Dec 2022 16:16:57 +0100 Subject: Add custom scripts to bin folder --- .bin/clean.sh | 3 +++ .bin/download_music.sh | 26 ++++++++++++++++++++++++++ .bin/esp_upload.sh | 6 ++++++ .bin/file_upload.sh | 38 ++++++++++++++++++++++++++++++++++++++ .bin/update.sh | 4 ++++ 5 files changed, 77 insertions(+) create mode 100755 .bin/clean.sh create mode 100755 .bin/download_music.sh create mode 100755 .bin/esp_upload.sh create mode 100755 .bin/file_upload.sh create mode 100755 .bin/update.sh diff --git a/.bin/clean.sh b/.bin/clean.sh new file mode 100755 index 0000000..3e6bbfd --- /dev/null +++ b/.bin/clean.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +sudo emerge --ask --depclean; diff --git a/.bin/download_music.sh b/.bin/download_music.sh new file mode 100755 index 0000000..e3a3601 --- /dev/null +++ b/.bin/download_music.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +BOLD="\e[1"; +ENDCOLOR="\e[0m"; +Green="32"; +LightRed="31"; + +if ! [ $1 ]; then + echo "" + echo -e $BOLD";"";"$LightRed"m Please provide music url!"$ENDCOLOR + echo "" + exit +fi + +MUSIC_DIR="~/Documents/Music/%(artist)s/%(album)s/%(title)s-%(id)s.%(ext)s" +if [ $2 ]; then + MUSIC_DIR="${a}/%(artist)s/%(album)s/%(title)s-%(id)s.%(ext)s" +fi + +echo "" +echo -e $BOLD";"";"$Green"m Music will download to ${MUSIC_DIR} directory!"$ENDCOLOR +echo "" + +sleep 1 + +yt-dlp -x --audio-format mp3 --embed-metadata -o $MUSIC_DIR $1 diff --git a/.bin/esp_upload.sh b/.bin/esp_upload.sh new file mode 100755 index 0000000..27d8d41 --- /dev/null +++ b/.bin/esp_upload.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +# rm /tmp/arduino-sketch-*/ -r +~/.local/bin/arduino-cli cache clean +~/.local/bin/arduino-cli compile --fqbn esp8266:esp8266:nodemcuv2 +~/.local/bin/arduino-cli upload -p /dev/ttyUSB0 --fqbn esp8266:esp8266:nodemcuv2 diff --git a/.bin/file_upload.sh b/.bin/file_upload.sh new file mode 100755 index 0000000..0ff6c57 --- /dev/null +++ b/.bin/file_upload.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +BOLD="\e[1"; +ENDCOLOR="\e[0m"; +Green="32m"; +LightRed="31m"; + +echo "" +echo -e $BOLD";"";"$Green" FILE UPLOADER"$ENDCOLOR +echo "" + +if ! [ $1 ]; then + echo "" + echo -e $BOLD";"";"$LightRed" Please provide file path!"$ENDCOLOR + echo "" + exit +fi + +if [ $1 ]; then + echo -e " Are u sure u want upload this file: "$BOLD";"";"$Green" '$1'"$ENDCOLOR"? [y/N]: " + read -p " " input + echo "" + # read -r -p " " input + case $input in + [yY][eE][sS]|[yY]) + URL=$(curl -s -F "file=@$1" https://0x0.st); + echo -e " URL: "$BOLD";"";"$Green"$URL"$ENDCOLOR; + ;; + [nN][oO]|[nN]) + echo -e $BOLD";"";"$Green" OK"$ENDCOLOR; + ;; + *) + echo -e $BOLD";"";"$LightRed" Invalid input..."$ENDCOLOR; + exit 1 + ;; + esac + echo "" +fi; diff --git a/.bin/update.sh b/.bin/update.sh new file mode 100755 index 0000000..e6f9f8d --- /dev/null +++ b/.bin/update.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +sudo emerge --sync +sudo emerge --ask --verbose --update --newuse --deep @world; -- cgit v1.2.3