<commit_before>require "socket"

class Countinual < Loggerish
  COUNTINUAL_HOST = "api.countinual.com"
  COUNTINUAL_PORT = 1025

  def self.args
    [
      [ "--countinual-key", "-k", GetoptLong::REQUIRED_ARGUMENT,
        "log to a Countinual account (API key)" ],
      [ "--countinual-counter", "-c", GetoptLong::REQUIRED_ARGUMENT,
        "Countinual counter (default is \"pullups\"" ],
    ]
  end

  def after_initialize
    if @enabled = !!@parent.config["countinual-key"]
      @parent.vputs "enabling Countinual logging module"

      if !@parent.config["countinual-counter"]
        @parent.config["countinual-counter"] = "pullups"
      end
    end
  end

  def log_pullup!(time)
    line = [
      @parent.config["countinual-key"],
      @parent.config["countinual-counter"],
      time.to_i,
      "+1",
    ].join(" ") + "\n"

    begin
      sock = UDPSocket.open                                                     
      sock.send(line, 0, COUNTINUAL_HOST, COUNTINUAL_PORT)
      @parent.vputs "logged pullup on countinual"
    rescue => e
      Rails.logger.info "Countinual error: #{e.message} (#{line.inspect})"     
    end
  end
end<commit_msg>countinual args swapped to match carbon<commit_after>require "socket"

class Countinual < Loggerish
  COUNTINUAL_HOST = "api.countinual.com"
  COUNTINUAL_PORT = 1025

  def self.args
    [
      [ "--countinual-key", "-k", GetoptLong::REQUIRED_ARGUMENT,
        "log to a Countinual account (API key)" ],
      [ "--countinual-counter", "-c", GetoptLong::REQUIRED_ARGUMENT,
        "Countinual counter (default is \"pullups\"" ],
    ]
  end

  def after_initialize
    if @enabled = !!@parent.config["countinual-key"]
      @parent.vputs "enabling Countinual logging module"

      if !@parent.config["countinual-counter"]
        @parent.config["countinual-counter"] = "pullups"
      end
    end
  end

  def log_pullup!(time)
    line = [
      @parent.config["countinual-key"],
      @parent.config["countinual-counter"],
      "+1",
      time.to_i,
    ].join(" ") + "\n"

    begin
      sock = UDPSocket.open                                                     
      sock.send(line, 0, COUNTINUAL_HOST, COUNTINUAL_PORT)
      @parent.vputs "logged pullup on countinual"
    rescue => e
      Rails.logger.info "Countinual error: #{e.message} (#{line.inspect})"     
    end
  end
end
{'fraction_non_alphanumeric': 0.13305084745762713, 'fraction_numerical': 0.005084745762711864, 'mean_word_length': 2.3825214899713467, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1647798', 'n_tokens_mistral': 799, 'n_tokens_neox': 776, 'n_words': 160}