Skip to content

Instantly share code, notes, and snippets.

View mlindgren's full-sized avatar
:octocat:
https://www.youtube.com/watch?v=eO6OaVnbqaY

Mitch Lindgren mlindgren

:octocat:
https://www.youtube.com/watch?v=eO6OaVnbqaY
View GitHub Profile
@mlindgren
mlindgren / garmin-connect-change-activities.js
Created April 8, 2022 03:44
One-liner to change the type of all activities shown on the page in Garmin Connect
// Change all activity types on the page to eBiking
jQuery('.js-changeActivityType').each(async function(){ if(jQuery(this).text() == "eBiking"){ jQuery(this).click(); console.log("Clicked"); await sleep(100); } } );
@mlindgren
mlindgren / spotify_recap.py
Created December 5, 2021 02:57
Get a list of your top songs and artists on Spotify sorted by time listened
import argparse
import csv
from dataclasses import dataclass
from datetime import datetime, timedelta
from os.path import exists
import pickle
import spotipy
from spotipy.oauth2 import SpotifyOAuth
@mlindgren
mlindgren / distancefix.py
Created January 24, 2020 00:21
Script to fix distance for indoor cycling activities in TCX files exported from Garmin Connect
import argparse
import datetime
import xml.etree.ElementTree as ET
# To do: should set this up dynamically from the xmlns in the file
ns = {'tcx' : "http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2"}
time_format = '%Y-%m-%dT%H:%M:%S.000Z'
parser = argparse.ArgumentParser(description = "Recalculate distance in TCX file for indoor activities")
parser.add_argument("file", type = argparse.FileType('r'), help = "Input TCX file")