Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
#A script for playing YouTube playlists
#Recommended mpv plugins: https://github.com/hoyon/mpv-mpris, https://github.com/cniw/mpv-discordRPC
trap "echo Exiting...; kill -s KILL 0; exit" SIGINT SIGTERM
trap "exit" SIGKILL
browser=$(xdg-mime query default application/x-extension-html)
browser=${browser%%.desktop}
browser=${browser:-firefox}
#!/usr/bin/env bash
#A master.m3u8, playlist.m3u8 and index-v1-a1 downloader
#Licensed under the GNU AGPLv3
#Warning: selecting a specific *.m3u8 from a master or playlist file is unsupported! This downloader will pick the first one, you can manually supplement it with another one if preferred.
#The slashes there make no sense, I know
#Usage: escapeURL "url"
escapeURL()
{
printf ${1//\//\\/}
#!/usr/bin/env bash
#A script for playing YouTube playlists
#Recommended mpv plugins: https://github.com/TheCactusVert/mpv-sponsorblock, https://github.com/hoyon/mpv-mpris
browser=firefox
echo "Input YouTube playlist link: "
read -r link
id=$([[ "$link" =~ ^https?\:\/\/(www|m)\.youtube\.com\/watch\?v\=[A-Za-z0-9_]+\&list\=([A-Za-z0-9_]+) ]] && \
echo "${BASH_REMATCH[2]}")
echo "Fetching playlist JSON from YouTube..."
yt-dlp "$link" -j --flat-playlist --cookies-from-browser $browser > $id.json
@bbaster
bbaster / other-starred-projects-gh.sh
Created January 1, 2024 22:46
Program for counting the common repositories starred by users who have also starred a specified repo
#!/usr/bin/env bash
#Program for counting the common repositories starred by users who have also starred a specified repo.
#Ensure that you have both "jq" and "gh" installed and that gh is authenticated with your account - anonymous requests have a much lower rate limit.
#WARNING: As an API request is sent for every single stargazer, your GitHub API rate limit may be significantly consumed! Use with caution.
destdir=~/analyzed-repos
mkdir -p $destdir
echo -n "Input the repository owners' username and the name of the repository, using the syntax \"<owner>/<repository_name>\": "