3 ms·
[off-topic] Following the spirit of UNIX, I did a little analysis on the upvotes this post got over time (fish-shell): while true; curl -sL 'https://news.y
by ducktective 4y ago
[off-topic]
Following the spirit of UNIX, I did a little analysis on the upvotes this post got over time (fish-shell):
while true; curl -sL 'https://news.ycombinator.com/item?id=32534173' | pup '#score_32534173 text{}' | awk -F'[^0-9]*' '{print $1}' | tee -a points; sleep 15s; end
(Initially I used `grep -Po '\d+'` but switched it with an awk solution due to...context!)
I started it approx. when I posted it. Now ~2 hours have passed since. Using `gnuplot`:
f(x) = a*x+b; fit f(x) "points" via a,b; set terminal png size 1920,1080 enhanced font "Inconsolata,20" ;set output "HN-analysis.png" ;set grid; set ylabel "points";set key bottom right ; set xlabel "sample # (15s interval)"; plot 'points' w linesp lt 7 lw 3 lc rgb "orange", f(x) lc rgb 'blue' lw 2
We generate the plot: https://i.imgur.com/pS6AaI5.png https://i.imgur.com/pS6AaI5.png
(The jump #100 sample is due to a network error on my side)
And here are the coeffs. of a linear fit over the data (note that every 4 samples is 1 minute, so this post got ~1.52 upvotes per minute)
a = 0.380809, b = 19.8437
- sargstuff 4y ago?? nroff grap not installed ?? ;) https://n-t-roff.github.io/heirloom/doctools/grap.1.html https://n-t-roff.github.io/heirloom/doctools/grap.1.html
- ducktective 4y agoI didn't get it :) Are you suggesting another method for graphing?
- sargstuff 4y agoGRAP was/is Bell Labs developed software (by L. Bentley & Brian W. Kernighan ). gnuplot was/is Berkley / GNU developed software. Guess more of a 70's/80's pre-open source observational comment.
- sargstuff 4y agoGetting a t-shirt with "awk < 1" printed on it hand auto-grap-ed by Brian Kernighan would be more memorable though.
- deleted 4y ago[deleted]
- wpietri 4y agoThis is cool. Thanks for sharing how you did it. Nice to see awk being used in a post about awk!
- defrost 4y agoFun stuff ... now correct by plotting X-axis as actual lapsed epoch time since start of sampling :-) ( For bonus fun, fit successive unbiased moving averages of a selectable width, for further fun do this for non uniform sample times .. time weighted, and look beyond simple moving averages to (say) Savitzky–Golay filter family for both uniform and non uniform sampling intervals )