Hacker News new | ask | show | jobs
by listeria 476 days 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?
1 comments

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/