News for hackers. Stuff that matters.
Re:I keep turning my Google Sheets into phone-friendly webap... by tmpz22 on Wednesday January 01, 2025 @01:16PM (#42567883)
My format is

MM/DD/YYYY (i.e. 1/1/2025)

$sets x $reps $weight $name (i.e. 3x10 135 Bench Press)

I uploaded the log file to ChatGPT and had it spit out a Python script to parse into JSON:

``` for line in file:

    date_match = re.match(r'^(\d{1,2}/\d{1,2}).\*?$', line.strip())
    if date_match:
        # construct a new workout entry 
        # continue

    exercise_match = re.match(r'^(\d+)x(\d+)\s+(\d+)\s+(.+)$', line.strip())
    if exercise_match:
        # insert new exercise into current workout
        # continue
```

There are no comments on this comment yet.