Skip to content

Instantly share code, notes, and snippets.

@dmrazzy
dmrazzy / transient_benchmark.py
Created November 17, 2024 00:23 — forked from charles-cooper/transient_benchmark.py
generate benchmarks for transient storage
#!/usr/bin/env python
with open("benchmark_control.easm", "w") as f:
print("PUSH1 251", file=f)
print("PUSH1 1", file=f)
for _ in range(10_000): # stay roughly within codesize limit, still large enough for benchmark
print("DUP2 MUL", file=f)
print("DUP1 DUP1 POP POP", file=f)
@dmrazzy
dmrazzy / color-fields.markdown
Created November 5, 2024 05:03
Color Fields

Color Fields

I already wrote several pens with colored fields. They all had in common that the coloring is very slow, and the user has almost no control over the result. This pen tries to solve these issues.

#The controls

  • field type: you have the choice between several algorithms. I won't describe them here, just try them.
  • paint mode: basically, this program draws a field by drawing whole lines at a time. You can let the program draw them automatically, or draw them manually by moving the mouse with the left button pressed.
  • color choice mode: automatic or manual.
  • color: to choose the color when in manual color choice mode.
  • sat/lum randomness: this control randomly changes the saturation and luminosity defined by the previous controls. This allows to adjust the texture between smooth and fibrous.
@dmrazzy
dmrazzy / crypto-pbkdf2.js
Created August 1, 2024 19:48 — forked from chrisveness/crypto-pbkdf2.js
Uses the SubtleCrypto interface of the Web Cryptography API to hash a password using PBKDF2, and validate a stored password hash against a subsequently supplied password. Note that both bcrypt and scrypt offer better defence against ASIC/GPU attacks, but are not available within WebCrypto.
/**
* Returns PBKDF2 derived key from supplied password.
*
* Stored key can subsequently be used to verify that a password matches the original password used
* to derive the key, using pbkdf2Verify().
*
* @param {String} password - Password to be hashed using key derivation function.
* @param {Number} [iterations=1e6] - Number of iterations of HMAC function to apply.
* @returns {String} Derived key as base64 string.
*
@dmrazzy
dmrazzy / clades.json
Created May 4, 2024 02:36 — forked from Kwonstig/clades.json
ncov-clades-schematic
{
"name": "19A",
"color": "#462EB9",
"children": [
{
"name": "20A",
"color": "#4580CA",
"children": [
{
"name": "20B",
I am attesting that this GitHub handle dmrazzy is linked to the Tezos account tz1cfFApo67wscHUL9awFk5JJeJgSkVhDdQF for tzprofiles
sig:edsigtq9tbrFQZa2G5S4Mznd6fdSwRU5xRFGQ4R3CoYZUekJpfwoDbjBQpRwycoa9Fthq95zBBntkuPr7BrCZjn5MMXSbUhZwAK