Skip to content

Instantly share code, notes, and snippets.

"""
A script to fetch and analyze running activities from Strava for the current year's March.
This script uses the Strava API to:
1. Authenticate using OAuth 2.0
2. Retrieve all activities for March of the current year
3. Filter for running activities only
4. Calculate daily running distances in miles
5. Generate a table showing miles run each day in March
6. Export the results to 'march_running_activities.csv'
@anmolkabra
anmolkabra / gram_schmidt.py
Last active September 30, 2023 01:54
Gram Schmidt Process to orthogonalize a matrix's columns using NumPy
#!/usr/bin/env python
import numpy as np
import numpy.linalg as la
def orthogonalize(U, eps=1e-15):
"""
Orthogonalizes the matrix U (d x n) using Gram-Schmidt Orthogonalization.
If the columns of U are linearly dependent with rank(U) = r, the last n-r columns
will be 0.