Skip to content

Instantly share code, notes, and snippets.

Avatar

Rithvik Vibhu rithvikvibhu

View GitHub Profile
View login-with-hns.js
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 Dec 15, 2018
Web Cryptography API Examples
View webcrypto-examples.md
@pikhovkin
pikhovkin / weasyprint_complex_headers.py
Last active Feb 16, 2022
Repeat on each page of complex headers (eg, tables) except the first page
View weasyprint_complex_headers.py
# coding: utf-8
from weasyprint import HTML, CSS
def get_page_body(boxes):
for box in boxes:
if box.element_tag == 'body':
return box