Skip to content

Instantly share code, notes, and snippets.

View JeremyLG's full-sized avatar
🎧
On vacation

Jeremy JeremyLG

🎧
On vacation
  • Marseille
  • 05:14 (UTC +02:00)
View GitHub Profile
@JeremyLG
JeremyLG / python_memory_usage.py
Created October 6, 2019 17:34
Memory usage of python session
import sys
# These are the usual ipython objects, including this one you are creating
ipython_vars = ['In', 'Out', 'exit', 'quit', 'get_ipython', 'ipython_vars']
# Get a sorted list of the objects and their sizes in MB, E6 to E9 for GB
sorted(
[(x, sys.getsizeof(globals().get(x)) / 10E6 * 8)
for x in dir()
if
@JeremyLG
JeremyLG / ram.py
Created May 28, 2019 16:25
Jupyter RAM checker
import argparse
import re
import subprocess
import pandas as pd
import psutil
import requests
import tabulate
kernel_regex = re.compile(r".+kernel-(.+)\.json")