<commit_before># Licensed to BIGR, Erasmus MC under one or more contributor 
# license agreements. BIGR, Erasmus MC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

Facter.add("ip_address") do
  setcode do
    os_issue = `cat /etc/issue`    
    if os_issue.include? "Fedora" or
       os_issue.include? "Red Hat" or
	   os_issue.include? "Scientific" or
       os_issue.include? "CentOS" then
      Facter::Util::Resolution.exec("ifconfig | grep -B 1 'inet addr:' | awk '/eth/{getline; print}' | cut -d: -f2 | awk '{print $1}'")
    else
      Facter::Util::Resolution.exec("ifconfig | grep 'inet' | grep -v '127.0.0.1' | grep -v 'inet6' | cut -d: -f2 | awk '{print $1}'")
    end
  end
end<commit_msg>using ip addr instead of ifconfig for RHEL<commit_after># Licensed to BIGR, Erasmus MC under one or more contributor 
# license agreements. BIGR, Erasmus MC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

Facter.add("ip_address") do
  setcode do
    os_issue = `cat /etc/issue`
    if os_issue.include? "Fedora" or
       os_issue.include? "Scientific" or
       os_issue.include? "CentOS" then
      Facter::Util::Resolution.exec("ifconfig | grep -B 1 'inet addr:' | awk '/eth/{getline; print}' | cut -d: -f2 | awk '{print $1}'")
    else
      if os_issue.include? "Red Hat" then
        Facter::Util::Resolution.exec("ip addr | grep 'inet' | grep -v '127.0.0.1' | grep -v 'inet6' | cut -d: -f2 | awk '{print $2}' | awk -F'/' '{print $1}'")
      else
        Facter::Util::Resolution.exec("ifconfig | grep 'inet' | grep -v '127.0.0.1' | grep -v 'inet6' | cut -d: -f2 | awk '{print $1}'")
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.11802413273001508, 'fraction_numerical': 0.01583710407239819, 'mean_word_length': 3.3851239669421487, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 3, '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': '628422', 'n_tokens_mistral': 860, 'n_tokens_neox': 828, 'n_words': 335}