This file contains hidden or 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
| /** | |
| * Unique sets in JavaScript | |
| * | |
| * Inspired by https://fosstodon.org/@[email protected]/109354031141521705 | |
| * | |
| * Author: Timo Tijhof (2022). | |
| * License: Public domain. | |
| */ | |
| const NAMES = [ |
This file contains hidden or 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
| /** | |
| * Encrypts plaintext using AES-GCM with supplied password, for decryption with aesGcmDecrypt(). | |
| * (c) Chris Veness MIT Licence | |
| * | |
| * @param {String} plaintext - Plaintext to be encrypted. | |
| * @param {String} password - Password to use to encrypt plaintext. | |
| * @returns {String} Encrypted ciphertext. | |
| * | |
| * @example | |
| * const ciphertext = await aesGcmEncrypt('my secret text', 'pw'); |
This file contains hidden or 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 MAX = 100 * 1000 * 1000; // 100 million | |
| function powself(number) { | |
| if (number === 0) { | |
| return NaN; // matt does not like zero. | |
| } else { | |
| return Math.pow(number, number); | |
| } | |
| } |
This file contains hidden or 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
| /*! Requires Node 12.5+ | License: Public domain. */ | |
| const cluster = require('cluster'); | |
| const WORK_TOTAL = 10_000_000; | |
| const WORK_MILESTONE = 1_000_000; | |
| const WORK_ASSIGN_CHUNK = 100_000; | |
| const WORK_RESP_CHUNK = 1_000; | |
| const ALGO = 'md5'; |
This file contains hidden or 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
| /** | |
| * Requires Node 6.0+ | |
| * | |
| * Author: Timo Tijhof (2018). | |
| * License: Public domain. | |
| */ | |
| const cluster = require('cluster'); | |
| let pidLabel = cluster.isMaster ? 'master' : 'worker'; |
This file contains hidden or 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://tfl.gov.uk/corporate/terms-and-conditions/tfl-call-charges | |
| * | |
| * > The rate is 0.66p per minute. | |
| * > There is also a 40p connection charge. | |
| * > Call charges are rounded up to the nearest 10p, with a minimum charge of 60p. | |
| * | |
| * @param {number} seconds | |
| * @return {string} Cost in GBP | |
| */ |
NewerOlder