Skip to content

Instantly share code, notes, and snippets.

@jasonrudolph
Created January 31, 2009 12:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonrudolph/55536 to your computer and use it in GitHub Desktop.
Save jasonrudolph/55536 to your computer and use it in GitHub Desktop.
# Grab a password out of the 1Password keychain...finding it by "name"
def password_for_hostname(name)
password_info = `security 2>&1 >/dev/null find-generic-password -gs passwords.Password:#{name} 1Password.keychain`
password = password_info.match(/\"\:\"(.+)\"\}\"/)[1] rescue nil
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment