Skip to content

Instantly share code, notes, and snippets.

View stampyzfanz's full-sized avatar

stampyzfanz

View GitHub Profile
@stampyzfanz
stampyzfanz / offroadStravaGlobalHeatmap.js
Last active October 17, 2021 00:43
View only offroads tracks on Strava's Global Heatmap by drawing over the roads. Can help find footpaths and single trails.
// If you want to extend this functionality here are some docs: https://docs.mapbox.com/mapbox-gl-js/example/geojson-layer-in-stack/
// To add layers not in strava (ie cyclepaths specifically maybe) this looks promising: https://docs.mapbox.com/vector-tiles/reference/mapbox-streets-v8/
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
// Go to dark mode
for (let elt of document.querySelectorAll('label')) {
if (elt.innerHTML.includes('Dark')) {
@stampyzfanz
stampyzfanz / whatsappMessenger.js
Created October 6, 2021 00:31
Automated Whatsapp Web messager. Can also detect when a person is typing and cut them off.
function sendMsg(msg) {
let txt = document.querySelectorAll('._13NKt')[1]
txt.innerText = msg
let startTypingEv = new InputEvent('input', {
bubbles: true
});
txt.dispatchEvent(startTypingEv)
let enterEv = new KeyboardEvent('keydown', {altKey:false,
bubbles: true,
cancelBubble: false,
@stampyzfanz
stampyzfanz / Mapmyrun exporter.js
Last active October 3, 2022 06:32
Exports Mapmyrun workouts to a series of tcx files which can be imported into lots of software.
// # Javascript to copy in dev tools console
let data = await (await fetch("https://www.mapmyrun.com/internal/allWorkouts/?started_after=2020-01-29")).json()
// Change started_after for date you want to filter from or remove entirely for every workout
// Api parameters:
// number user= *id* - can be found in url of the person's profile ie https://www.mapmyrun.com/profile/[id]/activity_feed
// ISO-8601-date started_after= *date* for example this is valid 2020-01-29
// ISO-8601-date started_before= *date* this is another valid date 2011-10-05T14:48:00.000Z
// Remove ?user= to access only your own workouts
// Example url using all 3 parameters
// https://www.mapmyrun.com/internal/allWorkouts/?started_after=2020-01-29&started_before=2021-5-29&user=123456789
@stampyzfanz
stampyzfanz / tcxcombiner.py
Last active January 22, 2022 05:39
Combine tcx files into one.
# 1 Create a file minify.py in that directory with these contents or download it
# 2 Execute it with the command 'py tcxcombiner.py' in order to combine the files into one, and to optionally minify it
# The minification works by removing every x location data point and removing 94% of the distanceMeters, time, and altiitude tag.
# If any of them are desired, edit the following Trues to False
remove_distance = True
remove_time = True
remove_altitude = True