Skip to content

Instantly share code, notes, and snippets.

@henryx
henryx / ReadPKCS8.java
Created May 19, 2020 16:17
Read PKCS#8 RSA key
public class ReadPKCS8 {
/**
Read PKCS#8 RSA key, with or without passphrase. It requires Bouncycastle library
*/
public static void main(String[] args) throws IOException, PKCSException, OperatorCreationException {
var file = "a_pkcs8_rsa_key.p8";
var password = "passphrase";
Security.addProvider(new BouncyCastleProvider());
@henryx
henryx / dbtest.py
Last active July 16, 2021 09:54
Plain SQL vs ORM performances
# Inserting 50000000 rows (commit every 0 inserts):
# Plain query elapsed in: 0:03:44.024872
# PyPika query elapsed in: 0:37:52.236037
# SQLAlchemy ORM Exec query elapsed in: 1:45:11.338434
# SQLAlchemy ORM Object query elapsed in: 3:12:56.100726
# Inserting 50000000 rows (commit every 1000 inserts):
# Plain query elapsed in: 0:17:11.325788
# PyPika query elapsed in: 0:53:51.816650
# SQLAlchemy ORM Exec query elapsed in: 2:33:40.255574