Skip to content

Instantly share code, notes, and snippets.

@t4sk
Created February 11, 2022 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save t4sk/7d956bb3cbf8973aa51a53bf78de286f to your computer and use it in GitHub Desktop.
Save t4sk/7d956bb3cbf8973aa51a53bf78de286f to your computer and use it in GitHub Desktop.
meaning of life
const Web3 = require("web3");
const assert = require("assert");
const web3 = new Web3();
const email = "email@email.com";
const COLORS = [
"red",
"blue",
"yellow",
"orange",
"green",
"purple",
"pink",
"lime",
];
const ANIMALS = [
"bull",
"bear",
"crab",
"doge",
"kitty",
"frog",
"ape",
"whale",
];
const JOBS = [
"coder",
"auditor",
"hacker",
"miner",
"oracle",
"knife catcher",
"sandwich maker",
"bag holder",
];
const MISSIONS = [
"reach 51% hash power",
"go to moon",
"get a real job",
"go bankless",
"teach",
"find private key of 0 address",
"find my lost private key",
"give",
];
const COINS = ["BTC", "ETH", "DOGE", "LINK", "ADA", "SOL", "AVAX", "LUNA"];
const STRATEGIES = [
"hodl",
"ape",
"leverage",
"stake",
"lend",
"farm",
"burn",
"squeeth",
];
const LANGS = [
"Solidity",
"Vyper",
"Assembly",
"Rust",
"Python",
"Javascript",
"Go",
"Html",
];
const TRILEMMAS = [
"decentralization",
"scalability",
"security",
"decentralization",
"scalability",
"security",
"decentralization",
"scalability",
];
let hash = web3.utils.sha3(email);
// remove 0x
hash = hash.substring(2);
console.log(hash);
const parts = [];
for (let i = 0; i < 8; i++) {
parts.push(hash.substring(i * 8, i * 8 + 8));
}
assert(parts.join("") == hash);
const nums = parts.map((p) => parseInt(p, 16) % 8);
console.log(nums);
// ---------------------------------- //
const color = COLORS[nums[0]];
const animal = ANIMALS[nums[1]];
const job = JOBS[nums[2]];
const mission = MISSIONS[nums[3]];
const coin = COINS[nums[4]];
const strategy = STRATEGIES[nums[5]];
const lang = LANGS[nums[6]];
const trilemma = TRILEMMAS[nums[7]];
console.log(`Name: ${color} ${animal} ${job}`);
console.log(`Goal in life: ${mission}`);
console.log(`Investment strategy: ${strategy} ${coin}`);
console.log(`Go to programming language: ${lang}`);
console.log(`Blockchain trilemma I don't care about: ${trilemma}`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment