Skip to content

Instantly share code, notes, and snippets.

View yashbhutoria's full-sized avatar
👨‍💻
Making things happen

Yash Bhutoria yashbhutoria

👨‍💻
Making things happen
View GitHub Profile
@yashbhutoria
yashbhutoria / cache_decorator.py
Created June 30, 2020 15:20
A simple decorator to cache function calls with same arguments. Useful to optimize recursive functions with repeating calls.
# The decorator to cache function calls
def cached(func):
cache = dict()
def decorator(*args):
if tuple(args) not in cache:
cache[tuple(args)] = func(*args)
return cache[tuple(args)]
return decorator
# Usage example
@msubel
msubel / uuid_v4_excel_formula.txt
Created July 14, 2015 12:37
An Excel Fromula to generate a UUID v4
=LOWER(CONCATENATE(DEC2HEX(RANDBETWEEN(0;POWER(16;8));8);"-";DEC2HEX(RANDBETWEEN(0;POWER(16;4));4);"-";"4";DEC2HEX(RANDBETWEEN(0;POWER(16;3));3);"-";DEC2HEX(RANDBETWEEN(8;11));DEC2HEX(RANDBETWEEN(0;POWER(16;3));3);"-";DEC2HEX(RANDBETWEEN(0;POWER(16;8));8);DEC2HEX(RANDBETWEEN(0;POWER(16;4));4)))