2022-03-23 ___l_i_t_e_r_a_t_u_r_e__c_l_o_c_k____________________________________ I have been marvelling at the literature clock [0] idea for quite a while. Then I found the source code [1] and thought whether that could be done in a small shell script. Turns out it does: ``` #!/usr/bin/env bash URL="https://raw.githubusercontent.com/JohannesNE/literature-clock/master/litclock_annotated.csv" time_file+=$HOME/.litclock_annotated.csv if [ ! -f "$time_file" ]; then curl $URL -o "$time_file" fi while true; do clear awk 'BEGIN { FS = "|"; results=0; srand(); time = strftime("%H:%M") }; $0~time{ sub($2, "\033[1m"$2"\033[0m",$3); res[results++]=$3"\n\n"$4" -- "$5 }; END { l=int(rand()*results); print res[l]}' "$time_file" | fmt sleep 10; done ``` I am sure it can be done a bit cleaner but it works for me right now. Tell me about it! ___References________________________________________________________ [0]: https://literature-clock.jenevoldsen.com/ [1]: https://github.com/JohannesNE/literature-clock