Skip to content

Instantly share code, notes, and snippets.

View bregman-arie's full-sized avatar

Arie Bregman bregman-arie

View GitHub Profile
@bregman-arie
bregman-arie / ini_to_json.py
Last active August 17, 2020 07:17
Convert INI string to JSON
from collections import defaultdict
import configparser
def ini_to_json(ini):
"""Convert ini string to a dictionary and return it."""
config = configparser.ConfigParser(default_section=None,
interpolation=None)
config.read_string(ini)
config_dict = defaultdict(dict)
for section in config.sections():
@bregman-arie
bregman-arie / gist:dbbdb6a6a6a528fae355704176e2317c
Last active September 9, 2022 08:13
List all the supported keywords in an Ansible playbook
grep -R -i -E "\s+_\w+ \=" /usr/lib/python3.10/site-packages/ansible/playbook/* -o | sed 's/\s_//g' | tr -d = | uniq