Skip to content

Instantly share code, notes, and snippets.

View BjornvdLaan's full-sized avatar
👋

Bjorn van der Laan BjornvdLaan

👋
View GitHub Profile
@BjornvdLaan
BjornvdLaan / CoordinateTest.kt
Created February 27, 2022 14:28
[Kotest] How to add shrinking to custom generators
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.comparables.shouldBeGreaterThanOrEqualTo
import io.kotest.property.Arb
import io.kotest.property.Shrinker
import io.kotest.property.arbitrary.arbitrary
import io.kotest.property.arbitrary.nonNegativeInt
import io.kotest.property.checkAll
data class Coordinate(val x: Int, val y: Int)
@BjornvdLaan
BjornvdLaan / tox.ini
Created October 15, 2021 11:35
Starter template for tox when using docker-compose to set up dependent systems
[tox]
minversion = 3.24
envlist = py{39}-{mac,wsl}
skipsdist = True
[flake8]
exclude = .git,.tox,dist,doc,*lib/python*,*egg,build
[testenv]
allowlist_externals =
@BjornvdLaan
BjornvdLaan / ECDSA.sol
Created August 12, 2018 15:03
Verification of externally created ECDSA signatures in Solidity
pragma solidity ^0.4.24;
contract ECDSA {
function verify() public returns (bool) {
bytes32 message = ethMessageHash("TEST");
bytes memory sig = hex"bceab59162da5e511fb9c37fda207d443d05e438e5c843c57b2d5628580ce9216ffa0335834d8bb63d86fb42a8dd4d18f41bc3a301546e2c47aa1041c3a1823701";
address addr = 0x999471bb43b9c9789050386f90c1ad63dca89106;
@BjornvdLaan
BjornvdLaan / BLSExample.sol
Last active April 10, 2023 07:49
Verification of BLS signatures and BGLS aggregate signatures in Ethereum
pragma solidity ^0.4.14;
/*
Example of how to verify BLS signatures and BGLS aggregate signatures in Ethereum.
Signatures are generated using https://github.com/Project-Arda/bgls
Code is based on https://github.com/jstoxrocky/zksnarks_example
*/
contract BLSExample {