This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlite3 | |
import contextlib | |
import os | |
import sys | |
def clean_binja_snapshots(conn, limit = 1): | |
with conn as cur: | |
for section in [ 'snapshot', 'file_data' ]: | |
cur.execute(f'DELETE FROM {section} WHERE id NOT IN (SELECT id FROM {section} ORDER BY id DESC LIMIT ?)', (limit,)) |