CurlPaste Script for 0x0.st.
cat > /etc/profile.d/CurlPaste.sh << "EOF"
#!/bin/bash
# Begin of /etc/profile.d/CurlPaste.sh
[ -x /usr/bin/curl ] || return
CurlPaste() {
local file=$1
if [[ -z $file ]]; then
printf "Error: Usage: $0 [file] \n"
return 1
fi
if [[ -f $file ]]; then
printf "\n\t Uploading ${file} to 0x0 \n"
curl -F'file=@-' https://0x0.st < "${file}"
else
printf "\n\t Warning: File does not exist. \n"
return 1
fi
}
export -f CurlPaste
# End of /etc/profile.d/CurlPaste.sh
EOFMedia Functions for when "blfs/mpv" is installed.
cat > /etc/profile.d/MediaFunctions.sh << "EOF"
#!/bin/bash
# Begin of /etc/profile.d/MediaFunctions.sh
[ -x /usr/bin/mpv ] || return
Radio() {
mpv --audio-display=no --loop-playlist --shuffle --playlist="$1"
}
alias MPV='mpv --geometry=1280x720+1280+60'
keep_awake() {
while pgrep -x mpv >/dev/null; do
xscreensaver-command -deactivate >/dev/null
sleep 50
done
}
# for single media playback
Media() {
keep_awake &
local pid=$!
trap "kill $pid 2>/dev/null" EXIT
MPV --profile=fast --hwdec=auto-safe "${@}"
}
# for shuffle play and loop
SPlay() {
Media --shuffle --loop-playlist --playlist="$1"
}
# for play and loop
ZPlay() {
Media --loop-playlist --playlist="$1"
}
export -f keep_awake
export -f Radio
export -f Media
export -f SPlay
export -f ZPlay
PlayList() {
if [[ $1 == "r" ]]; then
find . -name "*.mp4" -type f -printf '%T@ %p\n' | sort -r | cut -d' ' -f2-
elif [[ $1 == "n" ]]; then
find . -name "*.mp4" -type f -printf '%T@ %p\n' | sort | cut -d' ' -f2-
else
echo "Usage: PlayList [r|n] > playlist.m3u"
fi
}
export -f PlayList
# End of /etc/profile.d/MediaFunctions.sh
EOF