Skip to content

Instantly share code, notes, and snippets.

@northtree
northtree / Dockerfile
Last active June 28, 2019 09:41
Test memory leakage on uploading file to Google Cloud Storage
FROM python:3.7
COPY . /app
WORKDIR /app
RUN pip install --upgrade pip
RUN pip install memory_profiler
RUN pip install google-cloud-storage
ENTRYPOINT ["python", "-m", "memory_profiler", "test_gcp_storage.py"]
@northtree
northtree / time_decorator.py
Last active January 10, 2019 03:54
Time Decorator #python #decorator
from time import time
def timeit(method):
def timed(*args, **kw):
time_start = time()
result = method(*args, **kw)
time_end = time()
time_diff = (time_end - time_start) * 1000
print('{}: {:2.2f} ms'.format(method.__name__, time_diff))
return result