Skip to content

Instantly share code, notes, and snippets.

View Nasdin's full-sized avatar
🎯
Focusing

Nasrudin Bin Salim Nasdin

🎯
Focusing
View GitHub Profile
@Nasdin
Nasdin / hashmap.py
Created April 17, 2020 10:16
Hashmap in Python without dictionaries
# Implement a hashmap in Python without using a dictionary
# A simple toy example, look to improve when the hashes start clashing with each other either by adapting a dynamic size
# Or using a better hash function
class HashMap(object):
def __init__(self, size, hash_function):
self.array = [None] * size
self.size = size
@Nasdin
Nasdin / image_to_grid_knitting_pattern.py
Last active October 28, 2019 01:41
Takes an image and converts it to a grid knitting pattern as an excel file with colors and labelled with numbers. Arguments are 1. image path 2. desired height of grid 3. excel output path
import sys
import cv2
import numpy as np
import xlsxwriter
if len(sys.argv) != 4:
print("That's not how it works")
sys.exit(404)