Skip to content

Instantly share code, notes, and snippets.

View pettinen's full-sized avatar

Jeremias Pettinen pettinen

View GitHub Profile
@pettinen
pettinen / acme_register.py
Created January 11, 2024 21:55
Register a new account with an ACME server.
import hashlib
import json
import os
import platform
from datetime import datetime, UTC
from acme.client import ClientNetwork, ClientV2
from acme.messages import NewRegistration
from cryptography.hazmat.primitives.asymmetric.ec import generate_private_key, SECP256R1
from cryptography.hazmat.primitives.serialization import Encoding, PublicFormat
@pettinen
pettinen / big_if_true.rs
Created September 29, 2023 23:01
best thing i ever wrote
pub fn big_if_true<F: FnOnce()>(big: F) {
if true {
big();
}
}
@pettinen
pettinen / generate_secrets.py
Created June 14, 2021 16:04
Generates passwords and PINs.
#!/usr/bin/env python
from enum import Enum
import json
import secrets
import string
import sys
from typing import Iterable, Optional

Keybase proof

I hereby claim:

  • I am pettinen on github.
  • I am pettinen (https://keybase.io/pettinen) on keybase.
  • I have a public key whose fingerprint is 7D4C EE7A D636 82C0 83F5 FDB2 1B9F AE11 29B2 6723

To claim this, I am signing this object:

@pettinen
pettinen / create-certificate.sh
Created January 19, 2017 06:33
Create a self-signed SSL certificate with OpenSSL.
#!/bin/bash
# Create a self-signed SSL certificate with OpenSSL.
# libfaketime is required to customize the validity period.
HOSTNAME="flipflap"
IPADDR="0.0.0.0"
RSA_BITS=2048
FROM="2017-01-01 00:00:00"
DAYS=8400 # valid until 2040-01-01