That was many moons ago.
---
[0] Circa 2008, I could find several feeds from Janes that carried meaty non-subscriber extracts.
[1] LaTeX is picky about all sorts of "special" characters that are more common than one might expect.
876 karma · joined May 1, 2019
https://reindeereffect.github.io
That was many moons ago.
---
[0] Circa 2008, I could find several feeds from Janes that carried meaty non-subscriber extracts.
[1] LaTeX is picky about all sorts of "special" characters that are more common than one might expect.
... | sed -re 's/$/\n\n/' | uniq | man -Tps -l - | ...
If you have groff, you can also have `man` go straight to PDF. $ curl -s 'https://www.economist.com/united-states/2022/11/24/why-its-hard-to-buy-deodorant-in-manhattan' | grep articleBody | jq -r .articleBody 2>/dev/null | fmt A ⌊.+ B
will produce a new adjacency matrix (call it C) where each c_ij is the minimum traversal cost from node i to node j. For example, if A represented driving times from all cities in NY state to all airports in NY, and B represented direct flight times from all NY airports to all CA airports, then our result would be the minimum travel time (ignoring parking and security) between any NY town and any CA airport.The sequence `⌊.+` is an inner product chosen specifically to achieve this effect, with addition where multiplication would normally be, and ⌊ (min) where multiplication would normally be.
Notice that it took me longer to give this under-caffeinated explanation of what is going on than to write the code.
import spice
assert spice.flow() ytsearch
========
#! /bin/bash
nresults=$1; shift
query="$@"
yt-dlp -j --flat-playlist ytsearch${nresults}:"${query// /+}"
I now also have ytgetlist
=========
#! /bin/bash
yt-dlp -j --flat-playlist "$@"
which is handy for listing entire channels. The downside of using --flat-playlist is that the upload_date ends up null, so `ytplaylist` is modified to cope: ytplaylist
==========
#! /bin/bash
jq -r '"\(.upload_date // .playlist_index) \(.id) \(.duration)\t\(.title)"' "$@" \
| sort -k1n | uniq \
| fzf --bind "enter:execute(ytplay {+2})"
The playlist indices so far reflect the order one would get by sorting on upload date.- [0] https://fossbytes.com/dungeonfs-fuse-filesystem-dungeon-craw...
ytsearch
========
#! /bin/bash
nresults=$1; shift
query="$@"
yt-dlp -j ytsearch${nresults}:"${query// /+}"
This will give back my results as JSON, which I can save to a file or pipe to `ytplaylist`: ytplaylist
==========
#! /bin/bash
jq -r '"\(.upload_date) \(.id) \(.duration)\t\(.title)"' "$@" \
| sort | uniq \
| fzf --bind "enter:execute(ytplay {+2})"
Note that, because of the layout of the lines, records get sorted based first on date.Streaming is done via mpv:
ytplay
======
#! /bin/bash
id=$1; shift
mpv "ytdl://$id" --ytdl-format='best[height<=720]' "$@"
Finally, since I often don't care about saving results, wanting instead to just view the playlist, yt
==
ytsearch "$@" | ytplaylist
So, if I want to search for videos on butchering cows, I might do $ yt 5 butcher cow
as a preliminary to make sure I'm getting the sorts of results I want, then do $ yt 50 butcher cow
and get myself a beer. I could also save the results $ ytsearch 50 butcher cow > deadbeef.json
and view the results at my leisure with $ ytplaylist deadbeef.json
`deadbeef.json` will have extensive metadata for each video found, including a channel URL. Suppose with a bit of jq I find the URL for a really good channel; I can then $ yt-dlp -j $CHANNEL_URL > cool-channel.json
to get a playlist for the entire channel, then operate on it like the results coming back from `ytsearch`.Happy Friday.
[0] This is all subject to how much you care, of course. Not all automation is worth the hassle.
[1] His metaphor was actually garden hoses that screw together.
You have just made weddings vastly more entertaining.
[1] https://reindeereffect.github.io/2020/05/05/index.html
[2] https://reindeereffect.github.io/2020/05/05/images/5x5/new.p...
[0] https://archive.org/details/pdfy-MgN0H1joIoDVoIC7/page/n3/mo...
[1] https://en.wikipedia.org/wiki/Madeleine_(cake)
[2] Irma Rombauer, Marion Rombauer Becker, and Ethan Becker. Joy of Cooking (rev. ed.). Scribner. 1997. pp 962-963.
~/bin/freq
==========
#! /bin/bash
awk '{acc[$0]++} END {for (item in acc) {print acc[item], item}}' | sort -nr ~/bin/freq
==========
#! /bin/bash
sort "$@" | uniq -c | sort -nr
Once you get into the habit of capturing your habits as scripts that snap together like German nouns, you'll find the command line a wondrous place."I didn't, but I did stay at a Holiday Inn Express last night."
[1] https://reindeereffect.github.io/2018/12/08/index.html
[2] https://reindeereffect.github.io/2019/01/16/index.html
[3] https://github.com/reindeereffect/tools-from-blog/tree/maste...