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
/** | |
* calculateBits function can be used to get a rough measurement of how much | |
* memory a JavaScript object costs | |
* | |
* @author Mark Auger | |
* @social Follow me on GitHub at https://github.com/swimauger | |
* @license | |
* Copyright (c) 2021 Mark Auger | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy |
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
/** | |
* Fibonacci is a popular sequence known amongst both mathematicians and programmers. | |
* Fibonacci starts with 1,1 in the sequence and upon a specified iteration count | |
* will continue to add the last two numbers in the sequence. | |
* | |
* @author Mark Auger | |
* @social Follow me on GitHub at https://github.com/swimauger | |
* @license | |
* Copyright (c) 2021 Mark Auger | |
* |
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
/** | |
* 3x + 1 or the Collatz Conjecture is a simple mathematical conjecture | |
* that declares all positive integers will eventually reach a value of 1 | |
* | |
* Inspiration from https://www.youtube.com/watch?v=094y1Z2wpJg | |
* | |
* @author Mark Auger | |
* @social Follow me on GitHub at https://github.com/swimauger | |
* @license | |
* Copyright (c) 2021 Mark Auger |
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
openssl req -new -newkey rsa:4096 -x509 -sha256 -days 365 -nodes -out <key_name>.crt -keyout <key_name>.key |
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
function* UUIDGenerator() { | |
for (let i = 100000000000; true; i++) { | |
yield `${`${i}`.substr(0, 4)}-${`${i}`.substr(4, 4)}-${`${i}`.substr(8, 4)}`; | |
} | |
} | |
const uuid2 = UUIDGenerator(); | |
for (let i = 0; i < 10001; i++) { | |
console.log(uuid2.next().value) // 1000-0000-0000 -> 1000-0001-0000 |
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
// Create a UUID Generator | |
function* UUIDGenerator() { | |
for (let i = 0; true; i++) { | |
yield i; | |
} | |
} | |
// Initialize UUID Generator | |
const uuid = UUIDGenerator(); |