Skip to content

Instantly share code, notes, and snippets.

@fabianem
fabianem / Code.gs
Last active July 1, 2024 15:29
Google Apps Script to count emails by sender in batches
// Google Apps Script for counting emails by sender in batches. Stopps and resumes after 5mins of processing to avoid reaching script runtime limit.
// 1. Allow required permissions
// 2. Add gmail service to project
// 3. Fill <your-email> in `runProcessor` function and adjust query if needed
// 4. Run function `runProcessor`
// 5. Result will be saved in a new spreadsheet
// Based on ideas from https://stackoverflow.com/a/59222719/5162536 and
// https://medium.com/geekculture/bypassing-the-maximum-script-runtime-in-google-apps-script-e510aa9ae6da
@inkhorn
inkhorn / enron corpus processing v2.py
Created November 5, 2013 03:21
Enron Corpus Processing, version 2
docs = []
from os import listdir, chdir
import re
# Here's the section where I try to filter useless stuff out.
# Notice near the end all of the regex patterns where I've called
# "re.DOTALL". This is pretty key here. What it means is that the
# .+ I have referenced within the regex pattern should be able to
# pick up alphanumeric characters, in addition to newline characters