This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package listener | |
import ( | |
"context" | |
"fmt" | |
"github.com/ethereum/go-ethereum" | |
"github.com/ethereum/go-ethereum/accounts/abi/bind" | |
"github.com/ethereum/go-ethereum/common" | |
"github.com/ethereum/go-ethereum/core/types" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse, json, csv, decimal | |
parser = argparse.ArgumentParser(description="Convert Etherscan holders csv to json") | |
parser.add_argument('-i', '--csv', help="Etherscan holders csv") | |
parser.add_argument('-o', '--json', help="Output json file") | |
args = parser.parse_args() | |
with open(args.csv) as f: | |
reader = csv.DictReader(f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"from": "from@email.com", | |
"to": "to@email.com", | |
"server": { | |
"host": "smtp.emailserver.com", | |
"port": 587, | |
"password": "super-secret-password" | |
}, | |
"extService": "public-ip-api-url", | |
"ip_updater": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ZkAddress } from "./zkAddress.js"; | |
import { CensusGenProofZk } from "./zkCensus.js"; | |
(async function() { | |
// Create a ZkAddress instance from a provided string | |
const accountPrivateKey = "6430ab787ad5130942369901498a118fade013ebab5450efbfb6acac66d8fb88"; | |
const electionId = "c5d2460186f760d51371516148fd334b4199052f01538553aa9a020200000000"; | |
const censusRoot = "21f20a61be6bb9415b777367989313a2640109990d187e397fa74256361f0e11"; | |
const zkAddr = await ZkAddress.FromString(accountPrivateKey); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import random | |
import uuid | |
numOfUUIDS = int(sys.argv[1]) | |
def main(): | |
numCommons = int(numOfUUIDS * 0.025) | |
numRandom = numOfUUIDS - numCommons |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SVGDownloader { | |
constructor(source, filename = "download") { | |
this.filename = filename; | |
this.createCanvas(source.clientWidth, source.clientHeight); | |
this.createImage(source); | |
} | |
createCanvas(width, height) { | |
this.canvas = document.createElement("canvas"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<body> | |
<h1>Test umd</h1> | |
<script type="module"> | |
import Test from './main.js'; | |
Test(); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!Object.prototype.deepWatch) { | |
Object.prototype.deepWatch = function(f) { | |
let res = {}; | |
Object.keys(this).forEach(k => { | |
let src = this[k]; | |
if (Array.isArray(src)) { | |
res[k] = new Proxy(src, { | |
set(src, i, val) { | |
if (i !== "length") f.call(this, src, [...src, val]); | |
return Reflect.set(...arguments); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const base = 5; | |
function *sum(num) { | |
let result = num + base; | |
num = yield(result); | |
return (result + num); | |
} | |
let it = sum(16); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let carsArray = [ | |
["Ford", "Focus", 2.0], | |
["Seat", "Ibiza", 1.4], | |
["Seat", "Leon", 2.2] | |
]; | |
let carsObject = carsArray.map(([ brand, model, engine ]) => { // destructuring split array in single vars | |
return { brand, model, engine } // compact notation save as attribute vars with same name | |
}); | |
console.log(carsObject); // [ Object{brand: "Ford", model: "Focus", engine: 2.2}, ... ] |
NewerOlder