Skip to content

Instantly share code, notes, and snippets.

set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
const Benchmark = require('benchmark')
const ssz = require('../ssz-js/src')
const {serialize, deserialize, hashTreeRoot} = require('../ssz-ts/lib')
const suite = new Benchmark.Suite
const SubObj = {
fields: [
['x', 'uint8'],
['y', 'uint16'],
@wemeetagain
wemeetagain / bigint_vs_bn_vs_number.js
Last active February 8, 2023 05:22
BigInt vs BN.js vs number benchmark
const Benchmark = require('benchmark')
const BN = require('bn.js')
const suite = new Benchmark.Suite
// native numbers
let num_a, num_b
// BN.js numbers
let bn_a, bn_b
// native BigInt numbers
@wemeetagain
wemeetagain / bn_vs_number.js
Last active February 11, 2019 01:44
BN vs number benchmark
const Benchmark = require('benchmark')
const BN = require('bn.js')
const suite = new Benchmark.Suite
let num_a, num_b
let bn_a, bn_b
const randInt = () => Math.floor(Math.random() * 2**24)
@wemeetagain
wemeetagain / export-layers-to-pdf.py
Created April 16, 2018 18:04
GIMP plugin - Export Layers to PDF
#!/usr/bin/env python
#
# Author: helour
# Copyright: 2013-2015 helour
# Based on the cr33dog's script Export Layers as PNG (http://registry.gimp.org/node/18440)
# License: GPL v3+
#
# Version: 0.7.1
#
# GIMP plugin to export layers as a multiple pages PDF file
@wemeetagain
wemeetagain / multi-addr-identity.lll
Created August 6, 2014 04:42
Multi-address Identity Contract
;; multi-addr identity with address voting
;;
;; addresses have 4 commands (transaction types):
;; - vote_add(address,category,permission,lifespan)
;; - tx.data[0]==0
;; - This initiates a vote for `address` to be added to the member list.
;; This only works on addresses with a stored state of none(0) or
;; adding(1). If the vote total for `address` reaches 50% of voting
;; members, `address` is added to the member list. The category,
;; permission, lifespan args are optional once vote has been started.
Verifying myself: My Bitcoin username is +wemeetagain. https://onename.io/wemeetagain
@wemeetagain
wemeetagain / gist:10010923
Created April 6, 2014 20:08
basic friend list
if tx.sender != CONTRACTCREATOR:
stop
if tx.data[0] == 0:
contract.storage[1000+tx.value[1]] = tx.value[2]
elif tx.data[0] == 1:
suicide(CONTRACTCREATOR)
@wemeetagain
wemeetagain / gist:10010830
Created April 6, 2014 20:01
naive message board
// data[0] = topic
// data[1] = message
if tx.data[0]:
NEXTINDEX = contract.storage[sha3(tx.data[0])]
contract.storage[sha3(tx.data[0]) + 1 + NEXTINDEX] = tx.data[1]
contract.storage[sha3(tx.data[0])] = NEXTINDEX + 1
@wemeetagain
wemeetagain / gist:10010529
Created April 6, 2014 19:33
naive eth-mail
if tx.sender == CONTRACTCREATOR:
if tx.data[0] == 1:
suicide(CONRACTCREATOR)
else:
NEXTINDEX = contract.storage[999]
contract.storage[1000 + NEXTINDEX] = tx.data[0]
contract.storage[999] = NEXTINDEX + 1