Skip to content

Instantly share code, notes, and snippets.

View jmclong's full-sized avatar

Joshua Mark Coley Long jmclong

  • Microsoft
  • Atlanta, Georgia
View GitHub Profile
@jmclong
jmclong / jupyter_notebook_config.py
Created August 26, 2021 19:03
Save a copy of a Jupyter notebook in a '.history' folder every time the notebook is saved
import os
import shutil
import pathlib
from datetime import datetime
def post_save(model, os_path, contents_manager):
"""post-save hook for saving backups of jupyter files."""
if model['type'] != 'notebook':
return # only do this for notebooks
directory, filename = os.path.split(os_path)