<commit_before>require 'yaml'
namespace :user do

  desc "reset users password user:passreset['login','password']"
  task :passreset, [:login, :pass] => [:environment] do |t, args|
      user = User.where(:login => args.login).first      
      if user
        user.password = <PASSWORD>
        user.password_confirmation = <PASSWORD>
        user.save
        puts "updated password for #{user.login}"
      else
        puts "#{args.login} not found"        
      end  
  end

  # TODO allow for passing an id for simple lookup
  desc "lookup a user for any given login, email, or part of a name"
  task :lookup, [:find] => [:environment] do |t, args|
      puts "Args were: #{args}"
      find = args[:find]
      users = User.where("name ILIKE (?) OR uuid LIKE (?) OR email LIKE (?) OR login LIKE (?)", "%#{find}%", "%#{find}%", "%#{find}%", "%#{find}%")
      if users
         puts "report: id name login uuid provider email"          
         users.each do |u|
            puts "found: #{u.id} #{u.name} #{u.login} #{u.email}"
            teams = TeamUser.where(user_id: u.id).map(&:team)
            if teams
               teams.each do |t|
                  puts "   team: #{t.id} #{t.name} #{t.subdomain}"
               end
            else
               puts "user is not in a team"               
            end                      
         end
      else
         puts "not found"
      end
  end
end
<commit_msg>add omniauth_info<commit_after>require 'yaml'
namespace :user do

  desc "reset users password user:passreset['login','password']"
  task :passreset, [:login, :pass] => [:environment] do |t, args|
      user = User.where(:login => args.login).first      
      if user
        user.password = <PASSWORD>
        user.password_confirmation = <PASSWORD>
        user.save
        puts "updated password for #{user.login}"
      else
        puts "#{args.login} not found"        
      end  
  end

  # TODO allow for passing an id for simple lookup
  desc "lookup a user for any given login, email, or part of a name"
  task :lookup, [:find] => [:environment] do |t, args|
      puts "Args were: #{args}"
      find = args[:find]
      users = User.where("name ILIKE (?) OR uuid LIKE (?) OR email LIKE (?) OR login LIKE (?)", "%#{find}%", "%#{find}%", "%#{find}%", "%#{find}%")
      if users
         puts "report: id name login uuid email provider omniauth"          
         users.each do |u|
            puts "found: #{u.id} #{u.name} #{u.login} #{u.email} '#{u.provider}' '#{u.omniauth_info}'"
            teams = TeamUser.where(user_id: u.id).map(&:team)
            if teams
               teams.each do |t|
                  puts "   team: #{t.id} #{t.name} #{t.subdomain}"
               end
            else
               puts "user is not in a team"               
            end                      
         end
      else
         puts "not found"
      end
  end
end

{'fraction_non_alphanumeric': 0.13904109589041097, 'fraction_numerical': 0.0, 'mean_word_length': 1.800575263662512, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, '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': '6394970', 'n_tokens_mistral': 886, 'n_tokens_neox': 892, 'n_words': 288}