From d0624539a715b4a7c490f2cf80cfbd5fbf76c1de Mon Sep 17 00:00:00 2001 From: "Matheus A." Date: Thu, 25 Dec 2025 18:51:45 -0300 Subject: [PATCH] Many changes --- dot-services/sunshine-tweaks.service | 13 +++++ scripts/shell/adjust-urls-txt-files.sh | 3 + scripts/shell/dot-desktop-search.sh | 5 ++ scripts/shell/ffmpeg-join-videos.sh | 67 ++++++++++++++++++++++ scripts/shell/find-big-files.sh | 3 + scripts/shell/gdltool.sh | 18 ++---- scripts/shell/modrinth-get-versions.sh | 43 ++++++++++++++ scripts/shell/proj-llc-to-ffmpeg-helper.sh | 31 ++++++++++ scripts/shell/sunshine-tweaks.sh | 4 +- snippets/arrays-intersections.js | 19 ++++++ snippets/click-every-button-by-class.js | 1 + 11 files changed, 192 insertions(+), 15 deletions(-) create mode 100644 dot-services/sunshine-tweaks.service create mode 100755 scripts/shell/adjust-urls-txt-files.sh create mode 100644 scripts/shell/dot-desktop-search.sh create mode 100755 scripts/shell/ffmpeg-join-videos.sh create mode 100755 scripts/shell/find-big-files.sh create mode 100755 scripts/shell/modrinth-get-versions.sh create mode 100755 scripts/shell/proj-llc-to-ffmpeg-helper.sh create mode 100755 snippets/arrays-intersections.js create mode 100755 snippets/click-every-button-by-class.js diff --git a/dot-services/sunshine-tweaks.service b/dot-services/sunshine-tweaks.service new file mode 100644 index 0000000..92c73c4 --- /dev/null +++ b/dot-services/sunshine-tweaks.service @@ -0,0 +1,13 @@ +[Unit] +Description=Script Daemon For Sunshine Tweaks + +[Service] +Type=simple +#User= +#Group= +ExecStart=/usr/local/bin/sunshine-tweaks.sh +Restart=on-failure +StandardOutput=file:%h/sunshine_tweaks.log + +[Install] +WantedBy=default.target diff --git a/scripts/shell/adjust-urls-txt-files.sh b/scripts/shell/adjust-urls-txt-files.sh new file mode 100755 index 0000000..12c0e7e --- /dev/null +++ b/scripts/shell/adjust-urls-txt-files.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +fd -g "urls.txt" -X sed -i 's/vxtwitter\|fxtwitter\|twitter\|fixupx/x/g' diff --git a/scripts/shell/dot-desktop-search.sh b/scripts/shell/dot-desktop-search.sh new file mode 100644 index 0000000..d4a4d81 --- /dev/null +++ b/scripts/shell/dot-desktop-search.sh @@ -0,0 +1,5 @@ +DESKTOP_PATHS=( + /usr/share/applications/ + /usr/local/share/applications/ + ~/.local/share/applications/ +) diff --git a/scripts/shell/ffmpeg-join-videos.sh b/scripts/shell/ffmpeg-join-videos.sh new file mode 100755 index 0000000..229624b --- /dev/null +++ b/scripts/shell/ffmpeg-join-videos.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash + +# Usage example: +# ./ffmpeg-join-videos.sh -i vid1.mp4 vid2.mp4 vid3.mp4 -o output_name + +# Exit on error +set -e + +# Parse arguments +videos=() +output_filename="" + +while [[ $# -gt 0 ]]; do + case "$1" in + -i | --input-list) + shift + # Collect all filenames until another option appears or args end + while [[ $# -gt 0 && "$1" != -* ]]; do + videos+=("$1") + shift + done + ;; + -o | --output-filename) + output_filename="$2" + shift 2 + ;; + -h | --help) + echo "Usage: $0 -i file1 file2 [file3 ...] -o output_name" + exit 0 + ;; + *) + echo "Unknown option: $1" + exit 1 + ;; + esac +done + +# Validate args +if [[ ${#videos[@]} -lt 2 ]]; then + echo "Error: You must provide at least two input files with -i" + exit 1 +fi + +if [[ -z "$output_filename" ]]; then + echo "Error: You must provide an output filename with -o" + exit 1 +fi + +# Number of videos +n=${#videos[@]} + +# Build input args for ffmpeg +inputs=() +for vid in "${videos[@]}"; do + inputs+=("-i" "$vid") +done + +# Build the concat filter +filter="" +for i in "${!videos[@]}"; do + filter+="[$i:v] [$i:a] " +done + +filter_complex="${filter}concat=n=$n:v=1:a=1 [v] [a]" + +# Run ffmpeg +ffmpeg "${inputs[@]}" -filter_complex "$filter_complex" -map "[v]" -map "[a]" "${output_filename}.mp4" diff --git a/scripts/shell/find-big-files.sh b/scripts/shell/find-big-files.sh new file mode 100755 index 0000000..4a704b4 --- /dev/null +++ b/scripts/shell/find-big-files.sh @@ -0,0 +1,3 @@ +#!/bin/env bash + +fd . --size +10M --exec-batch exa --long --all --sort size --color=always --icons=always --ignore-glob desktop.ini | less --raw-control-chars diff --git a/scripts/shell/gdltool.sh b/scripts/shell/gdltool.sh index 74851fa..6a3278c 100755 --- a/scripts/shell/gdltool.sh +++ b/scripts/shell/gdltool.sh @@ -2,7 +2,7 @@ show_help() { # echo "Usage: `basename $0` [--no-abort-on-found] [--parallel] [--custom-grep-search|-c ]" - echo "Usage: $(basename $0) [--help|-h] [--filter-mode|-f]" + echo "Usage: $(basename "${0}") [--help|-h] [--filter-mode|-f]" echo "Options:" echo " --help | -h (optional) Display script's help text" echo " --filter-mode | -f (optional) The script iterate over the files of a selected folder and store the ones that should be deleted" @@ -12,7 +12,6 @@ show_help() { filter_mode=false urls_list_arg="" -interactive_mode=false while [ "$#" -gt 0 ]; do case "$1" in @@ -28,10 +27,6 @@ while [ "$#" -gt 0 ]; do urls_list_arg="$2" shift ;; - -i) - interactive_mode=true - shift 2 - ;; *) shift ;; esac done @@ -39,7 +34,7 @@ done commands_to_check=(gallery-dl gdl.sh feh xdotool) commands_not_found=() -for command in ${commands_to_check[@]}; do +for command in "${commands_to_check[@]}"; do if ! command -v "$command" &>/dev/null; then commands_not_found+=("$command") fi @@ -48,16 +43,15 @@ done if [ ${#commands_not_found[@]} -ne 0 ]; then echo 'The following commands are necessary in order to run the script, but were not found:' - for command in ${commands_not_found[@]}; do + for command in "${commands_not_found[@]}"; do echo " \"$command\"" done exit 1 fi -furry_commission_ideas_path=/mnt/e/clouds/nextcloud-velha-casa/data-hoarding/furry-downloads -# furry_commission_ideas_path=/mnt/e/home/documents-unsorted/data-hoarding/furry-downloads -# furry_commission_ideas_path=/mnt/e/home/downloads/furry-downloads +furry_commission_ideas_path='/media/hd/clouds/nextcloud-strawberry/data-hoarding/furry-downloads' +# furry_commission_ideas_path='/mnt/e/clouds/nextcloud-strawberry/data-hoarding/furry-downloads' furry_commission_ideas_urls_filename="urls.txt" scripts_path=/home/cloud/git/personal-devboot/scripts/shell @@ -234,7 +228,7 @@ fill_existing_folders_array() { ignore_paths_depth_2=("artists") ignore_paths_depth_last=("no-source" ".bsky.social" "old" "mine") - find_command="find * -type d" + find_command="find * -maxdepth 1 -type d" for path in "${ignore_paths[@]}"; do find_command+=" -not -path $path" diff --git a/scripts/shell/modrinth-get-versions.sh b/scripts/shell/modrinth-get-versions.sh new file mode 100755 index 0000000..6f394e5 --- /dev/null +++ b/scripts/shell/modrinth-get-versions.sh @@ -0,0 +1,43 @@ +#!/bin/env bash + +project_ids=( + 51shyZVL + 9s6osm5g + JYQhtZtO + KuNKN7d2 + LQ3K71Q1 + NNAgCjsB + P7dR8mSH + VSNURh3q + c7m1mi73 + eXts2L7r + fQEb0iXm + g96Z4WVZ + gvQqBUqZ + mOgUt4GM + uXXizFIs + wnEe9KBa + veinminer + veinminer-client +) + +# api_ids_query="%5B" +api_ids_query="[" + +for project_id in "${project_ids[@]}"; do + api_ids_query+="\\\"$project_id\\\"" +done + +# api_ids_query="${api_ids_query%",%20"}" + +# api_ids_query+="%5D" +api_ids_query+="]" + +api_command="wget -O- 'https://api.modrinth.com/v2/projects?ids=$api_ids_query'" + +api_response=$("$api_command") + +echo "$api_command" +echo "$api_response" + +exit 0 diff --git a/scripts/shell/proj-llc-to-ffmpeg-helper.sh b/scripts/shell/proj-llc-to-ffmpeg-helper.sh new file mode 100755 index 0000000..b7fbdb5 --- /dev/null +++ b/scripts/shell/proj-llc-to-ffmpeg-helper.sh @@ -0,0 +1,31 @@ +#!/bin/env bash + +ffmpeg_commands_list=() +files_count=1 + +for file in ./*-proj.llc; do + llc_filename_new="${file}.json" + + node -p "JSON.stringify(eval('(' + require('fs').readFileSync('${file}','utf8') + ')'), null, 2)" >"${llc_filename_new}" + + media_filename=$(cat "${llc_filename_new}" | jq -r '.mediaFileName') + + segments_qty=$(cat "${llc_filename_new}" | jq -r '.cutSegments | length') + + for seq in $((segments_qty - 1)); do + seq_start=$(cat "${llc_filename_new}" | jq -r ".cutSegments[${seq}].start") + seq_end=$(cat "${llc_filename_new}" | jq -r ".cutSegments[${seq}].end") + + ffmpeg_commands_list+=("ffmpeg-helper.sh -i \"${media_filename}\" --trim-start ${seq_start} --trim-end ${seq_end} --scale 1280x720 --crf 30 -o roadhog_${files_count}.mp4") + files_count=$((files_count + 1)) + done +done + +# rm ./*-proj.llc +# rm ./*-proj.llc.json + +echo 'Results' + +for cmd in "${ffmpeg_commands_list[@]}"; do + echo " ${cmd}" +done diff --git a/scripts/shell/sunshine-tweaks.sh b/scripts/shell/sunshine-tweaks.sh index e8364e3..5451b2d 100755 --- a/scripts/shell/sunshine-tweaks.sh +++ b/scripts/shell/sunshine-tweaks.sh @@ -21,13 +21,11 @@ is_sunshine_transmitting() { do_device_setup() { # trocar dispositivo padrão pactl set-default-sink "$default_device" - sleep 3 - # conectar dispositivo virtual do OBS pw-link "$obs_device$obs_device_fl" "$sunshine_device$sunshine_device_fl" pw-link "$obs_device$obs_device_fr" "$sunshine_device$sunshine_device_fr" - # talvez desconectar a saída do seu fone do sunshine?? + # talvez desconectar a saída do seu fone do sunshine? sleep 5 pw-link -d "$default_device$default_device_fl" "$sunshine_device$sunshine_device_fl" pw-link -d "$default_device$default_device_fr" "$sunshine_device$sunshine_device_fr" diff --git a/snippets/arrays-intersections.js b/snippets/arrays-intersections.js new file mode 100755 index 0000000..b03033a --- /dev/null +++ b/snippets/arrays-intersections.js @@ -0,0 +1,19 @@ +const versionsMatr = [ +] + +const loadersMatr = [ +] + +function intersectArrays(arrays) { + if (!arrays.length) return []; + + return arrays.reduce((acc, curr) => + acc.filter(item => curr.includes(item)) + ); +} + +const versionsIntersection = intersectArrays(versionsMatr); +console.log(versionsIntersection); + +const loadersIntersection = intersectArrays(loadersMatr); +console.log(loadersIntersection); diff --git a/snippets/click-every-button-by-class.js b/snippets/click-every-button-by-class.js new file mode 100755 index 0000000..63060bf --- /dev/null +++ b/snippets/click-every-button-by-class.js @@ -0,0 +1 @@ +document.querySelectorAll('button.MuiButtonGroup-lastButton').forEach(btn => btn.click());