<commit_before>#!/usr/bin/env ruby

require 'kconv'
require 'time'
require 'logger'
require 'net/imap'

require 'rubygems'
require 'pit'
require 'boxcar_api'

ENV['EDITOR'] = 'vi' if ENV['EDITOR'].nil?

config = Pit.get('pushr', :require => {
  :email           => '<EMAIL>',
  :password        => '<PASSWORD>',
  :boxcar_email    => '<EMAIL>',
  :boxcar_password => '<PASSWORD>'
})

logger = Logger.new STDOUT
logger.level = Logger::INFO

begin
  gmail = Net::IMAP.new 'imap.gmail.com', 993, true, nil, false
    logger.info 'Connect Gmail'

  gmail.login config[:email], config[:password]
    logger.info "Login #{config[:email]}"

  boxcar = BoxcarAPI::User.new config[:boxcar_email], config[:boxcar_password]
    logger.info "Connect Boxcar #{config[:boxcar_email]}"

  head = nil

  loop do
    gmail.select 'INBOX'
      logger.debug 'Select inbox'

    unseen = gmail.search ['UNSEEN']

    if unseen.nil? or unseen == 0<commit_msg>fix bug: unseen count 0<commit_after>#!/usr/bin/env ruby

require 'kconv'
require 'time'
require 'logger'
require 'net/imap'

require 'rubygems'
require 'pit'
require 'boxcar_api'

ENV['EDITOR'] = 'vi' if ENV['EDITOR'].nil?

config = Pit.get('pushr', :require => {
  :email           => '<EMAIL>',
  :password        => '<PASSWORD>',
  :boxcar_email    => '<EMAIL>',
  :boxcar_password => '<PASSWORD>'
})

logger = Logger.new STDOUT
logger.level = Logger::INFO

begin
  gmail = Net::IMAP.new 'imap.gmail.com', 993, true, nil, false
    logger.info 'Connect Gmail'

  gmail.login config[:email], config[:password]
    logger.info "Login #{config[:email]}"

  boxcar = BoxcarAPI::User.new config[:boxcar_email], config[:boxcar_password]
    logger.info "Connect Boxcar #{config[:boxcar_email]}"

  head = nil

  loop do
    gmail.select 'INBOX'
      logger.debug 'Select inbox'

    unseen = gmail.search ['UNSEEN']

    if unseen.empty?
{'fraction_non_alphanumeric': 0.16373333333333334, 'fraction_numerical': 0.004266666666666667, 'mean_word_length': 3.847545219638243, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 21, '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': '2153247', 'n_tokens_mistral': 684, 'n_tokens_neox': 653, 'n_words': 156}