Skip to content

Instantly share code, notes, and snippets.

@sergiolucero
sergiolucero / isa.py
Last active November 24, 2020 03:40
here isolines
from creds import ID,CODE # isolines: driving from my house
import folium
import requests
home =[-33.406654,-70.572701] # 085 LOS MILITARES / ALONSO DE CORDOVA
head = 'https://isoline.route.cit.api.here.com/routing/7.2/calculateisoline.json?'
URL_BASE = '{}app_id={}&app_code={}&mode=shortest;car;traffic:disabled&start=geo!{},{}&range={}&rangetype={}'
def isodata(home, range, type):
@richmondwang
richmondwang / python_jose_decode_cognito.py
Last active May 30, 2020 03:08
Gist to decode AWS cognito using the python Jose package
# -*- coding: utf-8 -*-
# pip install python-jose
from jose import jwt
token = "<token here>"
key = {
"alg": "RS256",
"e": "AQAB",
"kid": "+Sr66GHFIwrVWzl9N02mrm96OCoYbNktaekEhXs9+eM=", # <-- this should match the `kid` in the token's headers
@rondomondo
rondomondo / check_jwt_sig.py
Last active February 21, 2024 14:55
Two methods/examples of how to decode and verify the signature of AWS cognito JWT web tokens externally. This uses RSA key pair and alternatively PKCS1_v1_5. See https://gist.github.com/rondomondo/efff911f2c41c295e23415e94e12b8d3 for example of signing and verification by downloading an ISSUERS PKI SSL certificate from the signers website, and h…
#!/usr/bin/env python
import os
import time
import json
import base64
import requests
import argparse
from base64 import urlsafe_b64decode, b64decode
from Crypto.Hash import SHA256, SHA512