Skip to content

Instantly share code, notes, and snippets.

View rithvikvibhu's full-sized avatar

Rithvik Vibhu rithvikvibhu

View GitHub Profile
const fs = require('fs');
const crypto = require('crypto');
const decB64 = b64 => Buffer.from(b64, 'base64').toString('ascii');
const encB64 = ascii => Buffer.from(ascii).toString('base64');
const saveKeyToFile = (filename, key) =>
fs.writeFileSync(filename, key.export({ type: 'pkcs8', format: 'pem' }));
const loadKeyFromFile = filename => loadRawKey(fs.readFileSync(filename));
const loadRawKey = raw => crypto.createPrivateKey(raw);
@pedrouid
pedrouid / webcrypto-examples.md
Created December 15, 2018 01:07
Web Cryptography API Examples
@pikhovkin
pikhovkin / weasyprint_complex_headers.py
Last active February 3, 2024 17:04
Repeat on each page of complex headers (eg, tables) except the first page
# coding: utf-8
from weasyprint import HTML, CSS
def get_page_body(boxes):
for box in boxes:
if box.element_tag == 'body':
return box