Skip to content

Instantly share code, notes, and snippets.

View cjaSource's full-sized avatar

César Afonso cjaSource

  • OutSystems
View GitHub Profile
@cjaSource
cjaSource / sports-tracker-download.js
Last active August 18, 2023 11:21 — forked from bilan/sports-tracker-download.js
Download all workouts from sports-tracker
const key = "sessionkey=";
const valueStartIndex = document.cookie.indexOf(key) + key.length;
const token = document.cookie.substring(valueStartIndex, document.cookie.indexOf(';', valueStartIndex));
const activities = {0:"walk",1:"run",2:"ride",11:"hike",13:"alpineski",14:"rowing",15:"rowing"};
function downloadOne(item) {
var item = items[iGlobal];
const href = item.href;
const id = href.substr(href.lastIndexOf('/') + 1, 24);
const url = 'https://api.sports-tracker.com/apiserver/v1/workout/exportGpx/' + id + '?token=' + token;
@cjaSource
cjaSource / sports-tracker-download.js
Created August 18, 2023 10:42 — forked from anonymous/sports-tracker-download.js
Download all workouts from sports-tracker
// based entirely on this blog post:
// http://druss.co/2016/04/export-all-workouts-from-sports-tracker/
// unfortunately the original script no longer works, moslty because jQuery is
// no longer available on sports-tracker pages.
//
// I've compiled the changes proposed in the comments in the script below.
// to use the script, login to your sports-tracker account
// change URL to http://www.sports-tracker.com/diary/workout-list
// open browser console (Cmd-Shift-I)
@cjaSource
cjaSource / Directory.Build.targets
Last active February 15, 2021 12:44
Directory.Build.targets NET Core
<Project>
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../'))" />
<Target Name="beforebuild" BeforeTargets="build" Condition="'$(BuildingSS_fcbat)' != 'true'">
<PropertyGroup>
<Time>$([System.DateTime]::Now.ToString())</Time>
</PropertyGroup>
</Target>
<Target Name="afterbuild" AfterTargets="build" Condition="'$(BuildingSS_fcbat)' != 'true'">
<PropertyGroup>
<BuildTime>$([System.DateTime]::Now.Subtract($(Time)).ToString())</BuildTime>
@cjaSource
cjaSource / Directory.Build.targets
Last active February 15, 2021 12:44
Directory.Build.targets NETFramework
<Project>
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../'))" />
<UsingTask TaskName="LaunchTelemetry" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v12.0.dll">
<ParameterGroup>
<BuildTimeToRegister ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Using Namespace="System.Diagnostics" />
<Using Namespace="System.Runtime " />
<Code Type="Fragment" Language="cs">
@cjaSource
cjaSource / get_pin_from_certificate.py
Created January 30, 2017 16:31
Example script to generate Hash keys for SSL certificates
#!/usr/bin/env python2.7
"""
Original source: https://github.com/datatheorem/TrustKit/blob/master/get_pin_from_certificate.py
Helper script to generate a TrustKit or HPKP pin from a PEM/DER certificate file.
"""
from subprocess import check_output
import os.path
import argparse
import hashlib
import base64