Last active
December 7, 2018 14:16
-
-
Save xenithorb/e90713534624c93a834a92c2a0c6ee28 to your computer and use it in GitHub Desktop.
Revisions
-
xenithorb revised this gist
Dec 7, 2018 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ # Please place these in ~/.bashrc or equivalent yaml2json() { python3 < "${1:-/dev/stdin}" <( cat <<-EOF import sys, yaml, json json.dump(yaml.load(sys.stdin), sys.stdout, indent=4) @@ -10,7 +10,7 @@ yaml2json() { } json2yaml() { python3 < "${1:-/dev/stdin}" <( cat <<-EOF import sys, yaml, json yaml.safe_dump( json.load(sys.stdin), -
xenithorb created this gist
Jan 29, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ # Please place these in ~/.bashrc or equivalent yaml2json() { python < "${1:-/dev/stdin}" <( cat <<-EOF import sys, yaml, json json.dump(yaml.load(sys.stdin), sys.stdout, indent=4) EOF ) } json2yaml() { python < "${1:-/dev/stdin}" <( cat <<-EOF import sys, yaml, json yaml.safe_dump( json.load(sys.stdin), sys.stdout, explicit_start=True, default_flow_style=False ) EOF ) }