Skip to content

Instantly share code, notes, and snippets.

View leplatrem's full-sized avatar

Mathieu Leplatre leplatrem

View GitHub Profile
@leplatrem
leplatrem / resume.py
Created May 14, 2024 10:14
Resume download with requests
import os
import sys
import time
from urllib.parse import urlparse
import requests
def resume_download(url, filename):
resp = requests.head(url)
@leplatrem
leplatrem / upload.py
Created November 10, 2023 10:11
Upload file to Remote Settings in Python
import json
import os
import sys
import uuid
import mimetypes
import requests
filepath = sys.argv[1]

Github Actions Matrix Debug

Goal: Implement the matrix expansion behaviour in matrix_combinations() function, following the official Github Actions documentation.

Run tests:

pytest main.py
import datetime
import os
from github import Github # pip install --user PyGithub
september_first = datetime.datetime(2021, 9, 1)
def main():
// [dependencies]
// x509-parser = "0.9"
// ring = "0.16"
// oid-registry = "0.1"
use oid_registry;
use ring::signature;
use x509_parser::{self, certificate::X509Certificate, pem::Pem};
fn verify_chain(pem_content: &[u8]) {
import json
import os
from kinto_http import Client, BearerTokenAuth
SERVER = os.getenv("ENV", "prod")
SERVER_URL = {
"prod": "https://settings-writer.prod.mozaws.net/v1/",
"stage": "https://settings-writer.stage.mozaws.net/v1/",
➜ canonicaljson-spec git:(gh-pages) ./test.sh ../canonicaljson-rs/demo/target/debug/demo
malformed/empty OK
malformed/hex_number OK
malformed/invalid_string_character OK
malformed/invalid_string_escape OK
malformed/invalid_string_unicode_escape OK
malformed/leading_plus_number OK
malformed/leading_zero_number OK
malformed/missing_array_element OK
malformed/missing_integer_number OK
[package]
name = "contentsig"
version = "0.1.0"
authors = ["Mathieu Leplatre <[email protected]>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
base64 = "0.11.0"
import base64
import ecdsa
import requests
import cryptography.x509
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.hashes import SHA384
from cryptography.hazmat.primitives.asymmetric import ec as cryptography_ec
from cryptography.hazmat.primitives.asymmetric.utils import encode_dss_signature

Arpit Bharti - GSoC 2019 Progress Report

Project - Ship the Public Suffix List (PSL) over Remote Settings

Organization - Mozilla

Project Mentor - Mathieu Leplatre

Summary