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

require 'rubygems'
require 'mqtt'
require 'paint'

input_array = ARGV

if input_array.length == 2
  MQTT::Client.connect(input_array[0]) do |c|
    c.subscribe(input_array[1])
    c.get() do |topic,message|
      system('clear') 
      term_width = `/usr/bin/env tput cols`.to_i
      term_height = `/usr/bin/env tput lines`.to_i
      fill_string = ""

      for i in 1..term_height
        for j in 1..term_width
          fill_string = fill_string + "#"
        end
        fill_string = fill_string + "\n"
      end

      puts Paint[fill_string, message, message]<commit_msg>add option to turn off leds<commit_after>#! /usr/bin/env ruby

require 'rubygems'
require 'mqtt'
require 'paint'

control_key = "/turn"
status = 1 #0 = off, 1 = on
color = "red" #last set color

input_array = ARGV

def color_window(window_color)
  system('clear') 
  term_width = `/usr/bin/env tput cols`.to_i
  term_height = `/usr/bin/env tput lines`.to_i
  fill_string = ""

  for i in 1..term_height
    for j in 1..term_width
      fill_string = fill_string + "#"
    end
    fill_string = fill_string + "\n"
  end

  puts Paint[fill_string, window_color, window_color]
end

if input_array.length == 2
  color_window(color)
  MQTT::Client.connect(input_array[0]) do |c|
    c.subscribe(input_array[1])
    c.subscribe(input_array[1] + control_key)

    c.get() do |topic,message|
      if topic == input_array[1] + control_key
        if message == "off"
          status = 0
          color_window("black")
        elsif message == "on"
          status = 1
          color_window(color)
        end
      else
        color = message
        if status == 1
          color_window(message)
        else
          color_window("black")
        end
      end

{'fraction_non_alphanumeric': 0.1163575042158516, 'fraction_numerical': 0.01011804384485666, 'mean_word_length': 2.469785575048733, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3610680', 'n_tokens_mistral': 638, 'n_tokens_neox': 613, 'n_words': 151}