Skip to content

Instantly share code, notes, and snippets.

@talwrii
Created January 2, 2025 01:37
Show Gist options
  • Select an option

  • Save talwrii/464a1887aae74b35bfb9f96181655c08 to your computer and use it in GitHub Desktop.

Select an option

Save talwrii/464a1887aae74b35bfb9f96181655c08 to your computer and use it in GitHub Desktop.
Get the last started jupyter kernel
#!/usr/bin/python3
import os
from pathlib import Path
path = Path(os.path.expanduser("~/.local/share/jupyter/runtime/"))
files = sorted(path.iterdir(), key=lambda x: x.lstat().st_mtime)
print(files[-1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment