Skip to content

Instantly share code, notes, and snippets.

@vmx
vmx / ipld-strings.md
Last active October 16, 2020 12:51
IPLD: Strings

IPLD Strings

I want IPLD Strings to be valid UTF-8 only. This document provides counterarguments to [@warpfork arguing for IPLD Strings as sequence of 8-bit bytes]. If I took a parts from the @warpfork's document without any changes I prefix them with [verbatim].

[Appendix: Relationship to FFI]

FFI interfaces are concerned with interchange and at speed, the same choices are often correct for both.

@vmx
vmx / verify-params.sh
Last active August 6, 2020 13:03
Phase2 parameter transformation verification
#!/bin/sh
# This script verifies that the conversion from the trusted setup phase2
# results to the published parameters is correct.
#
# It verifies that:
#
# - The .vk file is just an extract of the phase2 result, without further
# modifications
# - The individual parts (.params and .contribs) are combined byte-identical
@vmx
vmx / index.html
Created July 10, 2020 14:29
Rendering Markdown with embedded Mathematics (bl.ocks.org compatible version)
This file has been truncated, but you can view the full file.
<!-- Saved from http://src/pl/filecoin/mdmath/mdmath.html at 2020-07-10T14:06:52Z using monolith v2.2.7 -->
<!DOCTYPE html><html lang="en"><head>
<meta charset="utf-8">
<title>Render Markdown file that contains Mathematics</title>
<link rel="stylesheet" crossorigin="anonymous" href="data:text/css;base64,QGZvbnQtZmFjZXtmb250LWZhbWlseTpLYVRlWF9BTVM7c3JjOnVybCgnZGF0YTpmb250L3dvZmYyO2Jhc2U2NCxkMDlHTWdBQkFBQUFBSUN3QUE0QUFBQUJGalFBQUlCV0FBRUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQm1BQWlHb0lMZ21YRnhFSUNvUGFhSUw2UUFFMkFpUURpQndMaEJBQUJDQUZqVThIa2o4TWdRb2JCT01YOEtZYnl1MGdQSTE2djA4VGJvd3pPQTlGY2VPSHcwWWlCT2NCU1ZEemo0MysvejhsNlpDeE1YVEF1YXEraWlrU2laS3BSR0FJWVRybUxGdFpKb1hzT1FaQ28zWElrZXprRnhlWHE3UDY3cVJ5M2VZaG10QnJ4UUxpWWhOaWt5aVg2N0VmSzc3STF3VGlJRWRHWnBMWTZ0Y2FaVk9Gc09WZktxSzJjaGFyNzRlYzBHYW4zUDBHZVkxS3VBNVRoWHJNSDdOSllEQkJURFEyU0k4V3UxYXYyOVl1aCtQY0pQWTArRXNsN2VRTWJCdjVrNXk4dy9PMjdiOS9kLy8vbTROajNXVHM0NDVqckR0dXduSEFMYWF5RG80aElFTkZISUFNeFRYUW5hQWJVWE5NMU5KYzRTbXBwWlZTMmxBck0wMGJsdVc4YmRZblRFc2hpQ1VFYllFYWt
@vmx
vmx / mdmath.html
Last active July 10, 2020 14:32
Rendering Markdown with embedded Mathematics
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Render Markdown file that contains Mathematics</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-zB1R0rpPzHqg7Kpt0Aljp8JPLqbXI3bhnPWROx27a9N0Ll6ZP/+DiW/UqRcLbRjq" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" integrity="sha384-y23I5Q6l+B6vatafAwxRu/0oK/79VlbSz7Q9aiSZUvyWYIYsd+qj+o24G5ZU2zJz" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/markdown-it.min.js" integrity="sha256-3mv+NUxFuBg26MtcnuN2X37WUxuGunWCCiG2YCSBjNc=" crossorigin="anonymous"></script>
<style>
@vmx
vmx / frameio_download.sh
Last active November 20, 2023 21:53
Download videos from Frame.io
#!/bin/sh
if [ "${#}" -eq 0 ]; then
echo "Usage: $(basename "${0}") frame.io-URL"
exit 1
fi
PAGE_URL=${1}
CURL_COMMAND=$(echo "${PAGE_URL}"|tr '/' ' '|awk '{ print "curl --silent -H x-review-link-id:" $4 " https://api.frame.io/v2/assets/" $5 }')
METADATA=$(${CURL_COMMAND})
@vmx
vmx / csv_htmlify.py
Created March 16, 2020 22:14
Script to convert a CSV file with Markdown to a CSV file with HTML
#!/usr/bin/env python3
import csv
import os
import cmarkgfm
FIELDNAMES = ['id', 'title', 'description']
with open('talks.csv', newline='') as inputfile:
@vmx
vmx / out001-12.log
Last active February 13, 2020 13:04
GPU/CPU testing related log
Compiling storage-proofs v1.0.0-alpha.0 (/home/ubuntu/vmx/rust-fil-proofs/storage-proofs)
Compiling filecoin-proofs v1.0.0-alpha.0 (/home/ubuntu/vmx/rust-fil-proofs/filecoin-proofs)
Compiling fil-proofs-tooling v0.6.1 (/home/ubuntu/vmx/rust-fil-proofs/fil-proofs-tooling)
Finished release [optimized] target(s) in 45.23s
Running `target/release/gpu-cpu-test`
2020-02-13T12:21:10.499 12923 main INFO gpu_cpu_test > Running high and low priority proofs in parallel
2020-02-13T12:21:10.499 12923 main INFO gpu_cpu_test > Force low piority proofs to CPU
2020-02-13T12:21:10.499 12923 main INFO gpu_cpu_test > Using threads
2020-02-13T12:21:11.241 12923 main INFO filecoin_proofs::api::seal > seal_pre_commit_phase1: start
2020-02-13T12:21:11.257 12923 main INFO filecoin_proofs::api::seal > building merkle tree for the original data
@vmx
vmx / out001.log
Last active February 6, 2020 10:35
out001.log: one high onw low priority thread, out002.log: no high priority thread (the threads are still named "high" and "low", but no locking is happening)
Finished release [optimized] target(s) in 0.18s
Running `/home/ubuntu/vmx/rust-fil-proofs/target/release/gpu-cpu-test`
2020-02-05T21:38:17.468 29733 main INFO gpu_cpu_test > Running high and low priority proofs in parallel
2020-02-05T21:38:17.469 29733 main INFO gpu_cpu_test > Force low piority proofs to CPU
2020-02-05T21:38:17.469 29733 main INFO gpu_cpu_test > Using threads
2020-02-05T21:38:18.527 29733 main INFO filecoin_proofs::api::seal > seal_pre_commit_phase1: start
2020-02-05T21:38:18.542 29733 main INFO filecoin_proofs::api::seal > building merkle tree for the original data
2020-02-05T21:38:18.888 29733 main INFO filecoin_proofs::api::seal > verifying pieces
2020-02-05T21:38:18.888 29733 main INFO filecoin_proofs::pieces > verifying 1 pieces
2020-02-05T21:38:18.888 29733 main INFO storage_proofs::stacked::proof > replicate_phase1
@vmx
vmx / failure-to-anyhow.txt
Created November 27, 2019 00:06
From `failure` to `anyhow`
https://github.com/filecoin-project/rust-fil-proofs/pull/956/files/4fd1396deb3172d824d97682f4366bfa9abacc09#diff-301ba6b17c22cbd0c1d0ecb79a8104be
let meta = serde_json::from_reader(file).map_err(FailureError::from)?;
->
let meta = serde_json::from_reader(file)?;
.ok_or_else(|| format_err!("could not map filename to parameter id"))?;
->
.context("could not map filename to parameter id")?;
@vmx
vmx / revive-tagged-values.diff
Created October 7, 2019 15:53
Reviving tagged values in Serde
commit 56080751ae37a4202b0681b36ab066bc838d9537
Author: Volker Mische <[email protected]>
Date: Fri Sep 27 00:28:51 2019 +0200
WIP
diff --git a/serde/src/de/mod.rs b/serde/src/de/mod.rs
index f1b8b312..646714c0 100644
--- a/serde/src/de/mod.rs
+++ b/serde/src/de/mod.rs