Skip to content

Instantly share code, notes, and snippets.

@Vizonex
Created November 11, 2025 23:38
Show Gist options
  • Select an option

  • Save Vizonex/a7f7b45b504fc2dd648d1ba2f373e73d to your computer and use it in GitHub Desktop.

Select an option

Save Vizonex/a7f7b45b504fc2dd648d1ba2f373e73d to your computer and use it in GitHub Desktop.
Fixer for pre-commit under the circumstances that were on windows and pre-commit-yaml doesn't decide to play nicely with us.
# Small mini fixer for pre-commit yaml to play nicely with windows since windows has it's own quirks unlike linux.
# This repairs and fixes the probelm.
import sys
import pathlib
if __name__ == "__main__":
if ("--help" in sys.argv) or ("-h" in sys.argv):
print(" fix_yaml.py <FILE>\n")
print(" FILE A yaml file that needs fixing")
print(" --help, -h Prints help and exits")
else:
path = pathlib.Path(sys.argv[1])
data = path.read_bytes().replace(b"\r\n", b"\n")
path.write_bytes(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment