4 ms·
Valanza – my Unix way for weight tracking and anlysis
- hilti 8mo agoLove your approach: small, composable programs working together through pipes!
- criticas 8mo agoNice idea, but "small composable programs" includes R scripts? That's great if you're already using R, a bit much to install if you're not. You could simplify things by cribbing from the Hacker's Diet (https://www.fourmilab.ch/hackdiet/ https://www.fourmilab.ch/hackdiet/) and using an exponentially weighted moving average as your filter. 10% of today's weight + 90% yesterday's EWMA. That's almost a one-liner in awk or perl, or a simple function in bash. Copilot suggests: awk 'BEGIN{alpha=0.1} NF>=2 { date=$1; w=$2; if (NR==1) ewma=w; else ewma=alpha*w + (1-alpha)*ewma; printf "%s\t%g\t%.6f\n", date, w, ewma }' input.txt
- dooglius 8mo agoI don't think "small" has ever been meant to include the runtime. Is R much more complex of a runtime than awk perl or bash?
- ablob 8mo agoFor the giggles: nice idea, but "small composable programs" includes perl scripts? That's great if you're already using perl, a bit much to install if you're not. There shouldn't be any burden of portability for the one writing small tools like these. You're free to rewrite it, of course, but expecting someone to go out of their way to stay within the unix/posix/whatever environment seems a bit much given the context of an unpaid endeavor.
- lallero317 8mo agoThat's literally what that lp1.awk does. The R script just fills the gaps in data by interpolating. Thanks for the link
- erikgahner 8mo agoGreat stuff! You can make minor adjustments to the R-script so you do not need to rely on {dplyr} and {tidyr}. For example, use merge() instead of left_join() and use the base pipe, |>, instead of the magrittr pipe, %>%.
- lallero317 8mo agoThanks. Just pushed. (I had never used R before).
- MisterTea 8mo agoA friend did similar using rc on Plan 9: https://shithub.us/rodri/rcfitness/HEAD/info.html https://shithub.us/rodri/rcfitness/HEAD/info.html
- lallero317 8mo agoAwesome, I needed this: I was going to implement something similar. Always been a big 9fan (not unintentionally there is a valanza.rc :P).
- notorandit 8mo agoNote. In southern Italian lingos, "valanza" means "scale".
- renewiltord 8mo agoSame root as valence surely
- notorandit 8mo agoItalian is "bilancia" (same root as balance).