<commit_before># Copyright (C) 2013 <NAME> (<EMAIL>).
# Licensed under the terms of the MIT license. See LICENCE for details.

# Run via top level rake file:
# $ rake example

require "lastpass"
require "yaml"

credentials = YAML.load_file File.join File.dirname(__FILE__), "credentials.yaml"

username = credentials["username"]
password = credentials["password"]

vault = LastPass::Vault.open_remote username, password

vault.accounts.each_with_index do |i, index|
    puts "#{index + 1}: #{i.id} #{i.name} #{i.username} #{i.password} #{i.url} #{i.group}}"
end
<commit_msg>GAuth support in the example<commit_after># Copyright (C) 2013 <NAME> (<EMAIL>).
# Licensed under the terms of the MIT license. See LICENCE for details.

# Run via top level rake file:
# $ rake example

require "lastpass"
require "yaml"

credentials = YAML.load_file File.join File.dirname(__FILE__), "credentials.yaml"

username = credentials["username"]
password = credentials["password"]

begin
    # First try without a multifactor password
    vault = LastPass::Vault.open_remote username, password
rescue LastPass::LastPassIncorrectGoogleAuthenticatorCodeError => e
    # Get the code
    puts "Enter Google Authenticator code:"
    code = gets.chomp

    # And now retry with the code
    vault = LastPass::Vault.open_remote username, password, code
end

vault.accounts.each_with_index do |i, index|
    puts "#{index + 1}: #{i.id} #{i.name} #{i.username} #{i.password} #{i.url} #{i.group}}"
end

{'fraction_non_alphanumeric': 0.12863913337846988, 'fraction_numerical': 0.006770480704129994, 'mean_word_length': 4.728682170542636, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, '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': '4581213', 'n_tokens_mistral': 486, 'n_tokens_neox': 472, 'n_words': 150}