Skip to content

Instantly share code, notes, and snippets.

@SimonSapin
SimonSapin / index.html
Created September 26, 2019 07:30
cargo-timing-20190926T070741Z.html for Servo
<html>
<head>
<title>Cargo Build Timings — servo 0.0.1</title>
<meta charset="utf-8">
<style type="text/css">
html {
font-family: sans-serif;
}
<html>
<head>
<title>Cargo Build Timings — servo 0.0.1</title>
<meta charset="utf-8">
<style type="text/css">
html {
font-family: sans-serif;
}
#!/home/simon/.virtualenvs/weasyprint/bin/python
import weasyprint
import markdown
import os
here = os.path.dirname(__file__)
with open(os.path.join(here, "resume.md"), encoding="utf-8") as f:
html = markdown.markdown(f.read(), extensions=["def_list"])
doc = weasyprint.HTML(string=html)
@SimonSapin
SimonSapin / pdfedit.py
Created December 21, 2020 10:51
Make a PDF file editable in LibreOffice, using Poppler and Inkscape
#!/usr/bin/env python3
"""
Make a PDF file editable in LibreOffice.
LibreOffice Draw can import and export PDF files, effectively making it a PDF editor.
However text in imported documents often looks broken, such as with
text rendered with a different font and overflowing into the next column.
What I suspect happens is that PDF files typically embed every font they use,
but LibreOffice’s internal document model does not support embedded fonts
@SimonSapin
SimonSapin / 0000-numeric-conversions.md
Created March 11, 2022 18:15
Rust pre-RFC: Add explicitly-named numeric conversion APIs
@SimonSapin
SimonSapin / nvs_postcard.rs
Created August 18, 2022 22:47
impl embedded_svc::storage::Storage for esp_idf_svc::nvs_storage::EspNvsStorage
use embedded_svc::storage::RawStorage;
use embedded_svc::storage::Storage;
use embedded_svc::storage::StorageBase;
use esp_idf_svc::nvs::EspDefaultNvs;
use esp_idf_svc::nvs_storage::EspNvsStorage;
use esp_idf_sys::EspError;
use std::sync::Arc;
pub fn default(namespace: &str) -> Result<PostcardStorage<EspNvsStorage>, EspError> {
let read_write = true;