Assorted shell and Python scripts
1#!/usr/bin/env -S uv run --script 2# /// script 3# dependencies = [ 4# "yaml", 5# ] 6# /// 7 8# YAML to JSON conversion script 9# Based on https://www.geeksforgeeks.org/convert-yaml-to-json/ 10# 11# This script takes a YAML file as the first arg, converts the 12# YAML content to JSON, and outputs the converted JSON content 13# to stdout. 14 15import json 16import sys 17 18import yaml 19 20try: 21 print(json.dumps(yaml.load(open(sys.argv[1]), Loader=yaml.FullLoader), indent=4)) 22except IndexError: 23 print("YAML file must be supplied as first arg") 24except FileNotFoundError: 25 print("YAML file not found")