Compare commits

..

11 Commits

Author SHA1 Message Date
e1ba233753 sync-camera: copy MOV file and *then* convert.
This is important to at least not keep files on the device for too long.
2025-04-11 12:53:14 +02:00
cbb8d1a9e8 launch-sway: Add script. 2025-04-11 12:53:01 +02:00
66b4328a30 Update play-lofi 2025-01-17 14:40:55 +01:00
9bb3049dd8 Remove ssh-tunnel. 2025-01-17 14:34:28 +01:00
e1295615d7 Remove setbg.
I don't need it anymore. It was used for DWM.
2025-01-17 14:33:28 +01:00
4ab77fd309 Remove monero-client.
I just use the GUI client now.
2025-01-17 14:32:39 +01:00
6eb456e667 sync-camera: Remove executable permission from file.
This happens because the device is a FAT32 formatted SD card, thus by
default everything is executable. But when transferring to my computer
this isn't necessary.
2025-01-16 09:43:34 +01:00
191784d1f2 sync-camera: require arguments. 2025-01-16 09:42:50 +01:00
e132462e5c sync-camera: clarify output path in info message. 2025-01-16 09:40:51 +01:00
7768df55a6 install-script: remove filename extension before installing. 2024-12-31 17:57:23 +01:00
0f439be1f9 README: Add a general license. 2024-12-31 11:15:40 +01:00
10 changed files with 65 additions and 69 deletions

16
LICENSE Normal file
View File

@ -0,0 +1,16 @@
MIT No Attribution
Copyright 2024 Nicolás Ortega Froysa <nicolas@ortegas.org>
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

1
README
View File

@ -1 +0,0 @@
A collection of all my scripts.

5
README.md Normal file
View File

@ -0,0 +1,5 @@
# My Scripts
This is a collection of personal scripts I use that others may also find useful.
All scripts here are licensed under the MIT No Attribution license, unless
otherwise specified (look at the header of the script).

View File

@ -2,4 +2,12 @@
set -euo pipefail
install -m 755 "$1" "$HOME/.local/bin"
SCRIPT_FILE="$1"
# Remove extension from script
if [[ $SCRIPT_FILE == *.* ]]
then
SCRIPT_FILE=${SCRIPT_FILE%.*}
fi
install -m 755 "$SCRIPT_FILE" "$HOME/.local/bin"

7
launch-sway Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
#export SDL_VIDEODRIVER=wayland
export _JAVA_AWT_WM_NONREPARENTING=1
export QT_QPA_PLATFORM=wayland
export XDG_CURRENT_DESKTOP=sway
export XDG_SESSION_DESKTOP=sway
exec sway

View File

@ -1,27 +0,0 @@
#!/bin/bash
set -euo pipefail
[ "$#" -eq 0 ] &&
echo "Requires a command. Run with 'help' for a list of commands." &&
exit 1
case $1 in
"wallet")
monero-wallet-cli --daemon-address node.monero.net:13666
;;
"address")
echo "42espNaUqPdJK4vTir4NDfH4gT6brFR4F5KPRADrg5t98LkzHnQfFnUDZZEetp3Zw5K8V4v364tN3TMxfg4eXEN9RpnrNBG"
;;
"help")
echo "USAGE: monero-client [command]
Commands:
address print out the monero public address
mine start the miner
wallet open the monero wallet
help show this help information"
;;
*)
echo "Invalid command '$1'. Please run with the 'help' option."
;;
esac

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# Copyright (C) 2020 Ortega Froysa, Nicolás <nicolas@ortegas.org> All rights reserved.
# Author: Ortega Froysa, Nicolás <nicolas@ortegas.org>
#
@ -37,16 +37,17 @@ Commands:
}
new_link() {
local results=$(curl -s "https://invidio.us/search?q=lofi+radio" |
local results
results=$(curl -s "https://invidious.tube/search?q=lofi+radio" |
grep "<p>.*watch" | tr -d "\n" | tr -s " ")
results=${results//\<p\>\<a href\=\"/\"https:\/\/invidio.us}
results=${results//\<p\>\<a href\=\"/\"https:\/\/invidious.tube}
results=${results//\"\>/\" \"}
results=${results//\<\/a\>\<\/p\>/\" þ }
results=${results::-2} # remove that last separator
# NOTE: I chose þ because never in a million years will that
# character be in the title of a lofi video stream.
IFS="þ" read -r -a streams <<< $results
IFS="þ" read -r -a streams <<< "$results"
echo "Streams:"
local id=1
@ -60,12 +61,12 @@ new_link() {
while [ "$opt" -gt "${#streams[@]}" ] || [ "$opt" -lt "1" ]
do
printf "Selection: "
read opt
read -r opt
done
link=${streams[$opt]}
link=${link//\" \"*/}
link=${link//*\"/}
echo $link > $link_file
echo "$link" > "$link_file"
}
# argument parsing
@ -85,7 +86,7 @@ elif [ "$#" -eq "2" ]
then
if [ "$1" = "set" ]
then
echo "$2" > $link_file
echo "$2" > "$link_file"
exit 0
else
echo "Unknown command '$1 $2'. Run 'play-lofi help' for a list of commands."
@ -104,28 +105,28 @@ then
while [ "$option" != "y" ] && [ "$option" != "n" ]
do
printf "Would you like to create one? [y/n] "
read option
read -r option
done
[ "$option" = "n" ] && exit 1
new_link
echo "New link file created."
fi
link=$(cat $link_file)
link=$(cat "$link_file")
# check if video is available
output=$(curl -s $link | grep "This video is unavailable.")
output=$(curl -s "$link" | grep "This video is unavailable.")
if [ -n "$output" ]
then
echo "The stream link '$link' is unavailable."
while [ "$option" != "y" ] && [ "$option" != "n" ]
do
printf "Would you like to find a new one? [y/n] "
read option
read -r option
done
[ "$option" = "n" ] && exit 1
new_link
echo "New link saved."
fi
mpv --no-video --msg-level=ffmpeg=no $link
mpv --no-video --msg-level=ffmpeg=no "$link"

14
setbg
View File

@ -1,14 +0,0 @@
#!/bin/bash
set -euo pipefail
if [ $# -gt 1 ]
then
echo "Too many arguments"
exit 1
elif [ $# -eq 1 ]
then
cp "$1" "$HOME/.local/share/wallpaper.jpg"
fi
xwallpaper --zoom "$HOME/.local/share/wallpaper.jpg"

View File

@ -1,11 +0,0 @@
#!/bin/bash
set -euo pipefail
# TODO:
# - Add options for port
# - Automatically get password from `pass`
PORT=12800
ssh -N -D "$PORT" nortega@themusicinnoise.net

View File

@ -11,6 +11,13 @@ function print_usage() {
echo "USAGE: ${0##*/} -d <device> -o <dir> [-t <dir>] [-r]"
}
if [ $# -eq 0 ]
then
>&2 echo "No arguments specified!"
print_usage
exit 1
fi
while getopts "d:o:t:rh" opt
do
case "$opt" in
@ -64,8 +71,9 @@ do
OUTPUT_PATH="$OUTPUT_DIR/${INPUT_FILE##*/}"
if ! [ -f "$OUTPUT_PATH" ]
then
echo "Copying ${INPUT_FILE} to ${OUTPUT_PATH} ..."
echo "Copying ${INPUT_FILE} to ${OUTPUT_PATH::-4}.jpg ..."
cp "$INPUT_FILE" "${OUTPUT_PATH::-4}.jpg"
chmod -x "${OUTPUT_PATH::-4}.jpg"
fi
if [ $REMOVE_FILES -eq 1 ]
@ -80,8 +88,12 @@ do
OUTPUT_PATH="$OUTPUT_DIR/${INPUT_FILE##*/}"
if ! [ -f "$OUTPUT_PATH" ]
then
echo "Converting ${INPUT_FILE} to MP4 at ${OUTPUT_PATH} ..."
ffmpeg -loglevel fatal -nostdin -i "$INPUT_FILE" "${OUTPUT_PATH::-4}.mp4"
echo "Copying $INPUT_FILE to ${OUTPUT_PATH} ..."
cp "${INPUT_FILE}" "${OUTPUT_PATH}"
echo "Converting ${INPUT_FILE} to MP4 at ${OUTPUT_PATH::-4}.mp4 ..."
ffmpeg -loglevel fatal -nostdin -i "$OUTPUT_PATH" "${OUTPUT_PATH::-4}.mp4"
echo "Removing temporary file $OUTPUT_PATH ..."
rm "$OUTPUT_PATH"
fi
if [ $REMOVE_FILES -eq 1 ]