Skip to content

Instantly share code, notes, and snippets.

View stefan-vatov's full-sized avatar
🦀
rock on

Stefan Vatov stefan-vatov

🦀
rock on
View GitHub Profile
@stefan-vatov
stefan-vatov / snippet.sh
Last active January 6, 2022 12:00
[std in user input bash] Re-enable user input in case stdin is already redirected
# Source: https://stackoverflow.com/questions/6561072/why-wont-bash-wait-for-read-when-used-with-curl
read git_name < /dev/tty # per-command I/O redirection
#read git_name < /dev/console # alternative
exec 0</dev/tty # script-wide I/O redirection
read git_name
@stefan-vatov
stefan-vatov / script.sh
Created January 6, 2022 12:01
[bash script user input] get user input from bash
read USERNAME
echo $USERNAME
# Hidden
read -s PASSWORD
echo $PASSWORD
@stefan-vatov
stefan-vatov / general.note.md
Last active January 16, 2022 01:38
[Obsidian templates]

<%* let title = tp.file.title if (title.startsWith("Untitled")) { title = await tp.system.prompt("Title"); await tp.file.rename(title); } tR += "---" %> Status: #inbox Title: <%* tR += title %>

@stefan-vatov
stefan-vatov / snippet.sh
Created March 1, 2022 11:54
[Bash ternary] quick if-else in bash
# Source: https://stackoverflow.com/questions/3953645/ternary-operator-in-bash
[[ $b = 5 ]] && a="$c" || a="$d"
# or
a=$([ "$b" == 5 ] && echo "$c" || echo "$d")
@stefan-vatov
stefan-vatov / snippet.sh
Created January 20, 2023 22:00
yt-dlp windows
youtube-dl -i -r 3M -s --prefer-free-formats --embed-thumbnail --yes-playlist https://www.youtube.com/playlist?list=PLZ_57qANz90qDJS1MeqMrXtaR7y4hwhOC
yt-dlp -F https://www.youtube.com/playlist?list=PLZ_57qANz90qDJS1MeqMrXtaR7y4hwhOC
yt-dlp -f 299 --embed-thumbnail https://www.youtube.com/playlist?list=PLZ_57qANz90qDJS1MeqMrXtaR7y4hwhOC
https://www.youtube.com/watch?v=_9aUy56n-yI&list=