super simple script to calculate best length of sleep
Find a file
Felisp 76593d1483 Initial and hopefully last commit
I should put up some more public repos so this one is not such an eyesore
2024-01-07 01:29:23 +01:00
README.org Initial and hopefully last commit 2024-01-07 01:29:23 +01:00
sleepCalc.lua Initial and hopefully last commit 2024-01-07 01:29:23 +01:00

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:

$ # now it's 01:23; we expect to fall asleep in 5 minutes
$ ./sleepCalc.lua 5
If gonna fall sleep at: 01:25
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

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