Skip to content

Instantly share code, notes, and snippets.

View feulf's full-sized avatar
🐢
slow and steady wins the race

Fed feulf

🐢
slow and steady wins the race
View GitHub Profile
num = 0b000000001
#print(bin(num))
num = 0b000000001 << 1 # 0b10
#print(bin(num))
num = 0b000000001 << 2 # 0b100
#print(bin(num))
num = 0b000000001 >> 1 # 0b0
import hashlib
hashed_list = [None] * 10 # create an array of None
def key_position(key):
string = key.encode() # convert to bytes
hashed_key = hashlib.sha256(string) # hash the string
hex_digest = hashed_key.hexdigest() # get the hex value
int_digest = int(hex_digest, 16) # convert to int
from queue import Queue
class BinaryTree:
def __init__(self, value):
self.value = value
self.left_child = None
self.right_child = None
def insert_left(self, value):
@feulf
feulf / random_nft.py
Created May 15, 2022 13:45
This code generates random patterns with ' ', +, and -
import random
symbols = ['-', '+', ' ', ' ', ' ', ' ']
def get_symbol(seed: int = 1):
# random.seed(seed)
r = int(random.random() * 1000)
return symbols[r % len(symbols)]
matrix = [[get_symbol(i + j) for i in range(40)] for j in range(20)]