Skip to content

Instantly share code, notes, and snippets.

@rjhornsby
Created March 9, 2023 20:37
Show Gist options
  • Save rjhornsby/790ce86c8bfd32241028a10f80f4c0e3 to your computer and use it in GitHub Desktop.
Save rjhornsby/790ce86c8bfd32241028a10f80f4c0e3 to your computer and use it in GitHub Desktop.
kitchen windows password
#!/usr/local/bin/python3
import clipboard as c
import os
import sys
import yaml
base_path = f"{os.getcwd()}/.kitchen"
files = [os.path.join(base_path, file) for file in os.listdir(base_path) if (file.lower().endswith('.yml'))]
files.sort(key=os.path.getmtime)
with open(files[-1], 'r') as kitchen_yaml:
box_setup = yaml.safe_load(kitchen_yaml)
c.copy(box_setup['password'])
print(f"Password copied to clipboard: '{box_setup['password']}'")
sys.exit(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment