Skip to content

Instantly share code, notes, and snippets.

View JAEarly's full-sized avatar
🦕

Joe Early JAEarly

🦕
View GitHub Profile
@JAEarly
JAEarly / memory_logging_function.py
Created May 3, 2020 13:30
Python Demo: Logging Memory Usage
import resource
def log_memory_usage():
# On linux, defaults to KB
memory_usage_kb = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
# Convert to GB
memory_usage_gb = memory_usage_kb / 1000000
# Output
print("Memory Usage: {:.3f}GB".format(memory_usage_gb))
@JAEarly
JAEarly / dropbox_download_and_extract.py
Created May 7, 2020 12:02
Download and extract a zip from Dropbox
import os
import urllib.request
import zipfile
from tqdm import tqdm
from util import create_dir_if_not_exist
ZIP_URL = "https://www.dropbox.com/s/<drop_box_id>/<file_name>?dl=1"
ZIP_PATH = "<path_to_download_dest>"
@JAEarly
JAEarly / commands.txt
Created June 20, 2020 14:50
PyPi Publishing Commands
Twine must be installed (pip install twine)
1. Bump version
2. python setup.py sdist
3. twine check dist/* (should be passed)
4. twine upload --repository-url https://test.pypi.org/legacy/ dist/* -u <username> -p <password> (test upload)
5. twine upload dist/* -u <username> -p <password> (true upload)
@JAEarly
JAEarly / Understanding_BiLSTM_Outputs.ipynb
Last active January 13, 2023 20:12
A Python Notebook on how to use bi directional LSTMs in PyTorch.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@JAEarly
JAEarly / mastering-subplot-legends-in-matplotlib.ipynb
Created March 1, 2023 17:36
Mastering Subplot Legends in Matplotlib
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.