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
// (Buffer is available in Node.js as a global, but we require it this way for compatibility) | |
// See: https://nodejs.org/api/buffer.html#buffer_buffer | |
const { Buffer } = require('buffer'); | |
const crypto = require('crypto'); | |
const keyPair = crypto.createECDH('secp256k1'); | |
keyPair.generateKeys(); | |
// Print the PEM-encoded private 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
# Recursive permutations in Python? Easy! | |
def permutation(arr): | |
if len(arr) > 1: | |
perms = [] | |
for i in range(0, len(arr)): | |
for variation in permutation(arr[:i] + arr[i + 1:]): | |
variation.append(arr[i]) | |
perms.append(variation) | |
return perms | |
else: return [arr] |
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
# Obvious code: | |
N, F, B = False, 'Fizz', 'Buzz' | |
seq = [N, N, F, N, B, F, N, N, F, B, N, F, N, N, F + B] | |
[print(seq[x % 15 - 1] or x) for x in range(1, 101)] | |
# How does it work? Just take a look at sample output, see that rhytm? | |
# 1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz | |
# 16 17 Fizz 19 Buzz Fizz 22 23 Fizz Buzz 26 Fizz 28 29 FizzBuzz | |
# 31 32 Fizz 34 ... ZZZZ | |
# And so on. It's being repeated each 15 steps. So I've just precalculated |