from Hacker News

Show HN: Convert English to Cron Expressions

by jacobpedd on 8/5/22, 4:43 PM with 57 comments

  • by txutxu on 8/5/22, 8:05 PM

    So nice!

    For prior art (not GPT-3 based) in debian/ubuntu based distributions:

        /usr/share/doc/cron/examples/crontab2english.pl
    
    I use to use it like:

        perl /usr/share/doc/cron/examples/crontab2english.pl /etc/cron.d/myfile
    
    
    Also prior to crontab.guru:

        $ head -2  /usr/share/doc/cron/examples/crontab2english.pl
        #!/usr/bin/perl
        #Time-stamp: "2001-07-29 16:07:28 MDT"
    
    21 years ago, more people did prefer english to cron :)
  • by Chico75 on 8/5/22, 5:36 PM

    This is incredible. While there is still a decent rate of false-positives or errors, it's such a nicer user interface than the powerful yet hard-to-read cron syntax.

    Any chance it could be made into a library/api?

  • by taude on 8/5/22, 5:37 PM

    A different take on the same idea: Cron tab Guru [1]. I use this tool all the time.

    I'd love a CLI version of this tool, where I pass in the cron expression and it tells me the english translation.

    [1] https://crontab.guru/

  • by jacobpedd on 8/5/22, 4:55 PM

    This was inspired by previous work using GPT-3 to generate regex. It uses the new codex model and works surprisingly well.

    Let me know if you get any interesting results!

  • by nicoburns on 8/5/22, 9:56 PM

    I feel like AI is a poor fit for this domain, because the whole point of using a tool like this would be to check/ensure correctness. Perhaps it should at least also offer a precise translation back the other way?

    Scheduled tasks are hard enough to debug as it is. The last thing I want to do is add more indeterminism!

  • by SnooSux on 8/5/22, 5:20 PM

    Really cool project, but I may have found a mistake. Typing "21st night september" returns “At 12:00 AM, on day 21 of the month, only in September”. And I would expect it to be maybe 9-11:59pm, not midnight that morning. But maybe 'night' is just not very well defined?
  • by coding123 on 8/5/22, 5:52 PM

    It nailed "every hour on Fridays" damn, must be ai backed.
  • by folkhack on 8/6/22, 2:50 AM

    > "every third thursday"

    ... nice. Other folks are beating ya up based on their first try but mine was exactly correct!

    Adding to my cron tools bookmarks - cool stuff.

  • by gfaster on 8/5/22, 5:27 PM

    This is pretty great. It would be nice if it were able to handle exceptions, for example:

    "The second Sunday of every month except in December"

  • by Daviey on 8/5/22, 7:12 PM

    Really liked, "Last Monday of every month except August".

    I tried other hard ones and got rate limited :(

  • by apugoneappu on 8/5/22, 10:17 PM

    This is so cool! Don't use cron jobs often but in love with the UI!

    I made a similar tool [1] to convert English to Excel formulas but would def take a page out of your super clean look!

    [1] https://www.tersho.com

  • by JLCarveth on 8/5/22, 5:14 PM

    This looks incredibly cool. One thing, the <title> has a typo: Chon Prompt
  • by seiferteric on 8/5/22, 6:01 PM

    It's erroring out on me but I wanted to try one of my stackoverflow questions from long ago that still gets frequent votes:

    Every 15 minutes except at 3AM?

    Stackoverflow responses say it can't be done in one line.

  • by zufallsheld on 8/5/22, 6:02 PM

    Great, using "never" as prompt results in:

    "At 12:00 AM, on day 31 of the month, only in February"

  • by zerop on 8/5/22, 5:56 PM

    Good tool . I Tried: "On alternate Saturday at noon"

    Not sure if it gave right results. but i think this is amazing stuff. Thanks for building it.

  • by foxbee on 8/5/22, 9:21 PM

    This is great. CRON presets are great, but this is perfect for allowing users to define their own CRON expressions. Nice work!
  • by throwfh80h82 on 8/5/22, 6:02 PM

    Cool tool, I'd use this.

    "When the stock market closes and opens" - I think the stock market opens at 9:30 though, not 9.

  • by mrlonglong on 8/7/22, 9:42 PM

    I gave it "every full moon" and it gave me 0 0 * * * *

    Still some more work, methinks.

  • by YourCupOTea on 8/5/22, 5:46 PM

    I keep getting the too many requests error even though I've never tried it before.
  • by jmprspret on 8/6/22, 10:40 AM

    A fun game is to put an emoji or two in the prompt and see what comes out :)
  • by iamandras on 8/6/22, 7:36 AM

    Oh, this is just cool. Nice work.
  • by tejtm on 8/5/22, 7:24 PM

    not finding an acceptable way to describe

    "first and third Tuesday at noon each month "

  • by owow123 on 8/6/22, 2:00 AM

    > 2 hours after 3 5 and 7

    > 0 2 3,5,7 * *

    Not great