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
// -> output range == equal max safe integer (~ 4 quadrillion) | |
// output string efficiency could be better, also first digit is often `1` | |
function randomString() { | |
const randomNum = Math.floor(Math.random() * Number.MAX_SAFE_INTEGER); // Generate a single random number | |
const boundedString = randomNum.toString(36); // Convert to base36 string | |
return boundedString; | |
} |
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 fs = require('fs').promises; | |
const path = require('path'); | |
async function getFolderSize(folderPath) { | |
let totalSize = 0; | |
async function calculateSize(currentPath) { | |
const files = await fs.readdir(currentPath, { withFileTypes: true }); | |
for (const file of files) { |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
[ | |
{ | |
"inputs": [ | |
{ | |
"internalType": "string", | |
"name": "name", | |
"type": "string" | |
}, | |
{ | |
"internalType": "string", |
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
0xE50E7A437D07DBE748BC2DA92019048810DE21E0 | N/A | mock0 | |
---|---|---|---|
0x80B27341D4218B757AB60D041DDDEC3F5738FD0A | N/A | mock1 | |
0x53A4ED85795FEF056A588771F23F0CDADD75B27B | N/A | mock2 | |
0x63D3F4C5D5077292CD965C1E667FFF5FCF2C3BC8 | N/A | mock3 | |
0x48ACF0979B69734B9F7CEC01A70B110EA21845F6 | N/A | mock4 | |
0xE0F70DBF8F326DACFAD31611579ABE896C5B911F | N/A | mock5 | |
0xB2E492456C4443F480D797B377D18EEE0109FB73 | N/A | mock6 | |
0x9F6EA389417EFBC73E7869878121A5EE9BB335E9 | N/A | mock7 | |
0x8509232EECF789B9E1F8BCEDC4FBD8A8220FE795 | N/A | mock8 | |
0xF2A4D9BEE944F95799A79C1169F17E0536E89450 | N/A | mock9 |
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
d = { | |
"data": { | |
"points": { | |
"1367193600": { | |
"v": [ | |
144.5399932861328, | |
0, | |
1603768864.5, | |
1, | |
11095675.5153929 |
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
//https://tools.ietf.org/id/draft-msporny-base58-01.html | |
// N=10, search space = 4e17 | |
// N=18, search space = 5e31 | |
function rand58(length) { | |
const base = ('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz').split('') | |
return Array.call(null, length).fill(0).map(() => base[Math.floor(Math.random() * 1e9) % base.length]).join('') | |
} |
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 sleep = (seconds) => { | |
return new Promise((accept) => | |
setTimeout(accept, seconds * 1000, `slept ${seconds}`), | |
); | |
}; | |
async function execParallel() { | |
console.log(new Date(), 'starting'); | |
// promises will execute concurrently, so that execution time = slowest one (not the sum) | |
const out = await Promise.all([sleep(5), sleep(5), sleep(5)]); |
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 main | |
import ( | |
"log" | |
"time" | |
) | |
type Kitty struct { | |
id uint | |
owner string |
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 threading import Thread | |
from queue import Queue | |
import time | |
num_worker_threads = 1 | |
print("start", time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime())) | |
def task(item): | |
print("IN", item) |
NewerOlder