top | item 43206977

(no title)

tero | 1 year ago

I use a template [1] that includes week numbers.

With some traditional GUI calendar software, I was often hunting and miscopying week numbers. Some software also had a weird (non ISO-8601) idea of week numbers.

In case you need calendar.txt after 2033, I wrote a small tool [2] to generate more templates.

[1] https://terokarvinen.com/2021/calendar-txt/calendar-txt-unti...

[2] https://terokarvinen.com/2021/calendar-txt/calendartxt-gener...

discuss

order

listeria|1 year ago

I also wrote a small tool to generate more templates, and it fits in a comment:

  usage: weeks YYYY-MM-DD YYYY-MM-DD
  
  weeks () {
      one_day=$((60 * 60 * 24))
      unix_from=$(date +%s --date="$1")
      unix_to=$(date +%s --date="$2")
  
      while [ $unix_from -lt $unix_to ]
      do
          echo @$unix_from
          unix_from=$((unix_from + one_day))
      done | date +'%F w%V %a' -f -
  
      unset -v one_day unix_from unix_to
  }
seriously, what's a compressed 1.2MB small tool?

tero|1 year ago

Nice!

Static binaries generated by Go are indeed large, even if the source code here is under 30 lines with support to some additional minor features (US and Finnish day names, command line help, optional week headings, day counts and parameter handling).

Here are some more scripts to generate calendar.txt date format:

https://terokarvinen.com/2024/format-date-calendar-txt/