#+OPTIONS: toc:nil * Sleep calc Silly script in Lua to help me with sleep planing. Should work well in termux. Developed with Lua5.3 should work in any Lua5 ** What it does: It prints what are the best times to wake up and duration of sleep when presented wake up times are used. Like this: #+BEGIN_SRC bash $ # now it's 01:23; we expect to fall asleep in 5 minutes $ ./sleepCalc.lua 5 If gonna fall sleep at: 01:28 Wake up | to sleep ------------------ 02:20 | 01h00m 03:20 | 02h00m 04:20 | 03h00m 05:20 | 04h00m 06:20 | 05h00m 07:20 | 06h00m 08:20 | 07h00m 09:20 | 08h00m #+END_SRC ** Usage - Two (optional) positional arguments 1) Number of minutes you estimate it will take you to fall asleep - Default is 40 because I'm the only expected audience and I always to pray to Luna & Celestia before sleep 2) How many minutes one sleep cycle takes - Default is 90minutes ** Notice - Don't quote me on this I haven't actually done any research in this area - This is just summarized knowledge I collected from randoms on the internet - Most of it is probably wrong or oversimplified - Total amount of research that went into this is < 5 - I just did it a few times and felt it actually worked (could be placebo) ** Basic ideas - Ideal power nap is 20min - Light sleep part of sleep is every 1h30m - if you wake up in some multiple of 90 minutes, you should feel fresh a well rested