Skip to content

Instantly share code, notes, and snippets.

View serapath's full-sized avatar
💔
Github was acquired

Alexander Praetorius serapath

💔
Github was acquired
View GitHub Profile
@serapath
serapath / merkleproof.js
Created May 10, 2021 22:21
merkle proof
/******************************************************************************
MERKLE PROOF
*******************************************************************************
EXAMPLE 1: (as a regular indexed tree)
,---0 = 0000 0000 0000 0000 // LVL_0 : 0 + 2 * 0 (chunk 0)
,---1 = 0000 0000 0000 0001 // LVL_1 : 1 + 4 * 0 (chunk 1)
| `---2 = 0000 0000 0000 0010 // LVL_0 : 0 + 2 * 1 (chunk 2)
|
,---3 = 0000 0000 0000 0011 // LVL_2 : 3 + 8 * 0 (chunk 3)
@serapath
serapath / AwardToken.sol
Last active March 27, 2022 11:32
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.23+commit.124ca40d.js&optimize=false&gist=
import "github/OpenZeppelin/zeppelin-solidity/contracts/token/ERC20/MintableToken.sol";
import "gist/Ballot.sol";
contract AwardToken is MintableToken {
uint quantity;
uint ballotPeriod = 7 hours;
Ballot public currBallot;
address[] public prevWinners;
event log (string _msg);
event winLog (address _win);
@serapath
serapath / filesystem.md
Last active September 17, 2022 03:43
JSON file system

So what about leaning on require('fs').stats method and the .stats property

// "" (empty string) as a property key is valid json
var fs = {
  "a" : {
    // maybe not ALL of those properties make sense in a "json file system",
    // so only the meaningful ones should exist
    "/type": "directory",
      // is one of ['file', 'directory', 'blockdevice' , 'characterdevice', 'symlink', 'FIFO', 'socket']
    "/dev": 2114,