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

if ARGV.empty?
  abort "Usage: #{$0} directories"
end

ARGV.each do |dir|
  Dir.chdir __dir__

  unless Dir.exists? dir
    $stderr.puts "no such directory \"#{dir}\""
    next
  end

  Dir.chdir dir

  Dir['*'].each do |dir_item|
    if File.directory? dir_item
      $stderr.puts "skipping directory \"#{dir_item}\""
      next
    end

    unless File.executable? dir_item
      $stderr.puts "skipping non-executable file \"#{dir_item}\""
      next
    end

    $stdout.puts "running \"#{dir_item}\""

    system "./#{dir_item}"
  end
end
<commit_msg>cron: run-dir: update code style (better output, better chdir form)<commit_after>#!/usr/bin/env ruby

abort "Usage: #{$0} directories" if ARGV.empty?
 
Dir.chdir __dir__

ARGV.each do |dir|

  unless Dir.exists? dir
    warn "no such directory: #{dir}"
    next
  end

  Dir.chdir dir do
    Dir['*'].each do |dir_item|
      if File.directory? dir_item
        warn "skipping directory: #{dir_item}"
        next
      end

      unless File.executable? dir_item
        warn "skipping non-executable file: #{dir_item}"
        next
      end

      puts "running: #{dir_item}"

      system "./#{dir_item}"
    end
  end
end

{'fraction_non_alphanumeric': 0.1330049261083744, 'fraction_numerical': 0.0016420361247947454, 'mean_word_length': 2.5747800586510263, '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': '3572988', 'n_tokens_mistral': 442, 'n_tokens_neox': 428, 'n_words': 120}