<commit_before>#!/usr/bin/ruby
require 'socket'
require 'json'
module Milight
  def self.config()
      milight_config = File.expand_path(
                       File.join(
                         ENV['JANE_PATH'], 'config', 'milight.json'
                       )
                     )
      return JSON.parse(File.read(milight_config), symbolize_names: true)
    end

  # master list of commands here: http://www.limitlessled.com/dev/

  wifi_bridge_ip = config[:wifi_bridge_ip]
  wifi_bridge_port = config[:wifi_bridge_port]

  ######## GROUP 1 ########
  #define lamp states
  lamp_on = "\x45\x00\x55"
  lamp_off = "\x46\x00\x55"

  #define white
  white_init = "\x45\x00\x55"
  white_finish = "\xC5\x00\x55"

  #define max brightness
  max_bright = "\x4E\x1B\x55"

  #define max dim
  max_dim = "\x4E\x02\x55"

  #define disco mode
  disco = "\x4D\x00\x55"

  #define speed states
  speed_up = "\x44\x00\x55"
  speed_down = "\x43\x00\x55"

  #define night mode
  night_mode = "\xC6\x00\x55"

  def self.run(command_parameter)
    case command_parameter[:command]
      when "on"
        on
      end
      
  end

  def self.on()
    socket = UDPSocket.new
    socket.send(lamp_on, 0, wifi_bridge_ip, wifi_bridge_port)
  end

  def self.off()
    socket = UDPSocket.new
    socket.send(lamp_off, 0, wifi_bridge_ip, wifi_bridge_port)
  end
  
  def self.white()
    socket = UDPSocket.new
    socket.send(white_init, 0, wifi_bridge_ip, wifi_bridge_port)
    sleep 0.1
    socket.send(white_finish, 0, wifi_bridge_ip, wifi_bridge_port)
  end

end<commit_msg>moved run<commit_after>#!/usr/bin/ruby
require 'socket'
require 'json'
module Milight
  def self.config()
      milight_config = File.expand_path(
                       File.join(
                         ENV['JANE_PATH'], 'config', 'milight.json'
                       )
                     )
      return JSON.parse(File.read(milight_config), symbolize_names: true)
    end

  # master list of commands here: http://www.limitlessled.com/dev/

  wifi_bridge_ip = config[:wifi_bridge_ip]
  wifi_bridge_port = config[:wifi_bridge_port]

  ######## GROUP 1 ########
  #define lamp states
  lamp_on = "\x45\x00\x55"
  lamp_off = "\x46\x00\x55"

  #define white
  white_init = "\x45\x00\x55"
  white_finish = "\xC5\x00\x55"

  #define max brightness
  max_bright = "\x4E\x1B\x55"

  #define max dim
  max_dim = "\x4E\x02\x55"

  #define disco mode
  disco = "\x4D\x00\x55"

  #define speed states
  speed_up = "\x44\x00\x55"
  speed_down = "\x43\x00\x55"

  #define night mode
  night_mode = "\xC6\x00\x55"

  def self.on()
    socket = UDPSocket.new
    socket.send(lamp_on, 0, wifi_bridge_ip, wifi_bridge_port)
  end

  def self.off()
    socket = UDPSocket.new
    socket.send(lamp_off, 0, wifi_bridge_ip, wifi_bridge_port)
  end
  
  def self.white()
    socket = UDPSocket.new
    socket.send(white_init, 0, wifi_bridge_ip, wifi_bridge_port)
    sleep 0.1
    socket.send(white_finish, 0, wifi_bridge_ip, wifi_bridge_port)
  end

   def self.run(command_parameter)
    case command_parameter[:command]
      when "on"
        on
    end
      
  end
  
end
{'fraction_non_alphanumeric': 0.12103746397694524, 'fraction_numerical': 0.039065001601024656, 'mean_word_length': 2.5459704880817253, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1153377', 'n_tokens_mistral': 1290, 'n_tokens_neox': 1169, 'n_words': 230}