Skip to content

Instantly share code, notes, and snippets.

@sthapa123
sthapa123 / xml2json.py
Created October 4, 2021 23:50
xml2json
from lxml import objectify
try: import simplejson as json
except ImportError: import json
def iterNodes(self, node, parentDict):
@sthapa123
sthapa123 / todict.py
Created March 15, 2021 14:55 — forked from sungitly/todict.py
convert python object recursively to dict
def todict(obj, classkey=None):
if isinstance(obj, dict):
data = {}
for (k, v) in obj.items():
data[k] = todict(v, classkey)
return data
elif hasattr(obj, "_ast"):
return todict(obj._ast())
elif hasattr(obj, "__iter__"):
return [todict(v, classkey) for v in obj]
# How to create an RPM repository
# This is for Redhat 64 bit versions of Linux. You can create your own RPM repository # to host your custom RPM packages.
#
# See "How to create an RPM from source with spec file" for more information.
# https://gist.github.com/1376973
# Step: 1
# Install createrepo
# How to create an RPM repository
# This is for Redhat 64 bit versions of Linux. You can create your own RPM repository # to host your custom RPM packages.
#
# See "How to create an RPM from source with spec file" for more information.
# https://gist.github.com/1376973
# Step: 1
# Install createrepo