<commit_before>dofile(os.getenv('HOME') .. '/.imapfilter/util.lua')

local password = get_pass('<EMAIL>', 'imap.gmail.com')
local me = '<EMAIL>'

function connect()
  return IMAP {
    server = 'imap.gmail.com',
    username = me,
    password = password,
    ssl = 'auto',
  }
end

function run()
  print "home: run"
  home = connect()
  inbox = home.INBOX

  --
  -- Mailing lists
  --

  messages =
    inbox:contain_from('<EMAIL>') +
    inbox:contain_from('<EMAIL>')
  print_status(messages, '* -> Lists')
  messages:move_messages(home.Lists)

  messages = inbox:
    contain_from('<EMAIL>'):
    match_field('X-campaignid', '.')
  print_status(messages, 'Lambda Legal -> Lists')
  messages:move_messages(home.Lists)

  --
  -- Notifications
  --

  messages =
    inbox:contain_cc('<EMAIL>') +
    inbox:contain_cc(me)
  print_status(messages, 'GitHub own activity -> archive & mark read')
  messages:mark_seen()
  messages:delete_messages() -- Archive

  --
  -- Recruiting
  --

  messages = inbox:contain_from('mirrorplacement.com')
  print_status(messages, '* -> Recruiting')
  messages:move_messages(home.Recruiting)
end

if os.getenv('DEBUG') then
  print 'DEBUG is set: running once.'
  run()
else
  print 'Looping, to run once set DEBUG.'
  forever(run, 60)
end<commit_msg>mutt: chaining beats operational composition<commit_after>dofile(os.getenv('HOME') .. '/.imapfilter/util.lua')

local password = get_pass('<EMAIL>', 'imap.gmail.com')
local me = '<EMAIL>'

function connect()
  return IMAP {
    server = 'imap.gmail.com',
    username = me,
    password = password,
    ssl = 'auto',
  }
end

function run()
  print "home: run"
  home = connect()
  inbox = home.INBOX

  --
  -- Mailing lists
  --

  messages =
    inbox:contain_from('<EMAIL>') +
    inbox:contain_from('<EMAIL>')
  print_status(messages, '* -> Lists')
  messages:move_messages(home.Lists)

  messages = inbox:
    contain_from('<EMAIL>'):
    match_field('X-campaignid', '.')
  print_status(messages, 'Lambda Legal -> Lists')
  messages:move_messages(home.Lists)

  --
  -- Notifications
  --

  messages = inbox:
    contain_cc('<EMAIL>'):
    contain_cc(me)
  print_status(messages, 'GitHub own activity -> archive & mark read')
  messages:mark_seen()
  messages:delete_messages() -- Archive

  --
  -- Recruiting
  --

  messages = inbox:contain_from('mirrorplacement.com')
  print_status(messages, '* -> Recruiting')
  messages:move_messages(home.Recruiting)
end

if os.getenv('DEBUG') then
  print 'DEBUG is set: running once.'
  run()
else
  print 'Looping, to run once set DEBUG.'
  forever(run, 60)
end
{'fraction_non_alphanumeric': 0.15621392843401308, 'fraction_numerical': 0.0015390534821085034, 'mean_word_length': 3.5694200351493848, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1446975', 'n_tokens_mistral': 937, 'n_tokens_neox': 906, 'n_words': 184}