Infinite sleep, can't program board

I made a very stupid mistake, I tried putting my arduino mkrwan 1300 to sleep.
The good news it goes to sleep and wake up and blinks the led a couple times and goes back to sleep.
The bad news: I can’t put another program on it anymore.
The time it wakes up, is not long enough to compile the program and upload the code.
When the board is sleeping my pc can’t find the board

Any suggestions?

This is the code:

#include <RTCZero.h>

/* Create an rtc object */
RTCZero rtc;

/* Change these values to set the current initial time */
const byte seconds = 0;
const byte minutes = 5;
const byte hours = 12;

/* Change these values to set the current initial date */
const byte day = 12;
const byte month = 1;
const byte year = 17;

bool matched = false;

void setup() {

  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, LOW);

  rtc.begin();

  rtc.setTime(hours, minutes, seconds);
  rtc.setDate(day, month, year);

  rtc.setAlarmTime(12, 06, 00);
  rtc.enableAlarm(rtc.MATCH_MMSS);

  rtc.attachInterrupt(alarmMatch);

  rtc.standbyMode();
}

void loop() {
  if (matched) {
    matched = false;
    digitalWrite(LED_BUILTIN, HIGH);
    delay(500);
    digitalWrite(LED_BUILTIN, LOW);
    delay(500);

    digitalWrite(LED_BUILTIN, HIGH);
    delay(500);
    digitalWrite(LED_BUILTIN, LOW);
    delay(500);
    int alarmMinutes = rtc.getMinutes();
    alarmMinutes += 1;
    if (alarmMinutes >= 60) {
      alarmMinutes -= 60;
    }

    rtc.setAlarmTime(rtc.getHours(), alarmMinutes, rtc.getSeconds());
    rtc.standbyMode();    // Sleep until next alarm match
  }
}

void alarmMatch() {
  matched = true;
}

You have two seconds during which it is alive. Don’t run the compiler but use avrdude directly to upload the precompiled binary.

I haven’t studied the bootloader of the MKR1300 but most native USB Arduinos have their bootloader active for some time after a reset. So you might first try that.