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
(async function() { | |
let defaultDerivePath = "m/44'/60'/0'/0/0"; | |
let hdnode = require('ethers/wallet/hdnode'); | |
let ss = require('ethers/wallet/secret-storage'); | |
//let words = 'verb position snow palace gift limb citizen alpha stay sphere swear proof'; | |
let words = 'tiger guilt skill adjust worry rival roof bicycle raven mail cherry strong body afford again praise upper wolf dry joke web bargain sea hint'; | |
let entropy = hdnode.mnemonicToEntropy(words); |
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
{ | |
"version":3, | |
"id":"14ed6caf-0b69-4348-85e6-6ea0b15352cd", | |
"address":"9ab14321b263d5c1a7715098a1a31510cb828409", | |
"Crypto":{ | |
"ciphertext":"838cc6626170166b2ec15911e496b603da6c08de8ef188d9f0ef27fd84d0c572", | |
"cipherparams":{ | |
"iv":"f6ed0a488d596de27adf087f9c9e6946" | |
}, | |
"cipher":"aes-128-ctr", |
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
{ | |
"address": "cf4aa487dece1b7bd0b5c1495222931f02fab1f3", | |
"id": "c24815ed-b06c-481f-bf0c-9747b18aac2d", | |
"version": 3, | |
"Crypto": { | |
"cipher": "aes-128-ctr", | |
"cipherparams": { | |
"iv": "b5e531fc4a67e6665e5e0d4a500ef738" | |
}, | |
"ciphertext": "8174066d494c46be31c59ef7fec1c6815c412e3762da68e76f7df263e6afee55", |
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
There is a simple way to check the last events in GitHub from certain user, including all his "git push" events: | |
https://api.github.com/users/{user}/events | |
Exmaple: https://api.github.com/users/nakov/events | |
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 ethers = require('ethers'); | |
let rnd256Bits = ethers.utils.randomBytes(256 / 8); | |
let mnemonics = ethers.HDNode.entropyToMnemonic(rnd256Bits); | |
let hdWallet = ethers.HDNode.fromMnemonic(mnemonics); | |
console.log("Wallet mnemonics:", mnemonics); | |
for (let index=0; index<5; index++) { | |
let key = hdWallet.derivePath(`m/44'/60'/0'/0/${index}'`); | |
console.log(`Private key #${index}: ${key.privateKey}`); |
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 aes = require("aes-js"); | |
const argon2 = require("argon2"); | |
const crypto = require("crypto"); | |
const cryptoJS = require("crypto-js"); | |
// Encrypt using AES-256-CTR-Argon2-HMAC-SHA-256 | |
async function aes256ctrEncrypt(plaintext, password) { | |
let argon2salt = crypto.randomBytes(16); // 128-bit salt for argon2 | |
let argon2Settings = { type: argon2.argon2di, raw: true, | |
timeCost: 8, memoryCost: 2 ** 15, parallelism: 2, |
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
npm install -g gitbook-cli | |
npm install -g serve | |
call gitbook install | |
call gitbook build . --log=debug --debug | |
start serve _book | |
start "" http://127.0.0.1:5000 | |
pause |
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
gitbook.events.bind("page.change", function() { | |
let runCodeLinks = $("p:contains('Run the above code example:') a"); | |
for (let link of runCodeLinks) { | |
if (typeof(link.href) == "string" && link.href.startsWith("https://repl.it/")) { | |
// A repl.it link is found --> check for code box above it | |
let codeBox = $(link).parent().prev(); | |
if (codeBox.is("pre")) { | |
// A code box is found just before the code link --> inject the [Run] button | |
let runButton = $("<a href='#' class='run-code-button' style='float:right'>Run</a>"); | |
let loadingBox = $("<span class='run-code-loading' style='float:right;display:none'>Loading …</span>"); |
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
SELECT REPLACE(post_title, " ", " ") FROM wp_posts |
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> | |
<head> | |
<meta charset="UTF-8"> | |
<script src="kinvey-example.js"></script> | |
</head> | |
<body> | |
<a id='buttonLoad' href='#'>[Load]</a> |