Skip to content

Instantly share code, notes, and snippets.

@MHMDhub
MHMDhub / ExampleXMLparsing.py
Last active June 27, 2017 05:03
Exaple xml parser 1 using etree. Copied from following repository Ganeshgq/verizon-code
import xml.etree.ElementTree as ET
import re
import os
import sys
import subprocess
from urllib2 import Request, urlopen
from urllib import urlencode
from json import load, dumps
from base64 import b64encode
from xml.etree.ElementTree import Element, SubElement, tostring, ElementTree
@MHMDhub
MHMDhub / homebrew.sh
Created February 25, 2017 20:06 — forked from geekygecko/homebrew.sh
Homebrew
# Howebrew package manager for OS X is useful for installing unix terminal tools.
# Install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
# Install wget
brew install wget
brew install openssl
# Update homebrew and all your packages
@MHMDhub
MHMDhub / dictMerge.py
Created August 14, 2016 19:50
Merge two Python dictionaries
x = {'a':1, 'b': 2}
y = {'c':10, 'd': 11}
z = dict(x.items() + y.items())
z
{'a': 1, 'b':2, 'c': 10, 'd': 11}
@MHMDhub
MHMDhub / two-equal-lists-merge.py
Created August 14, 2016 19:39
Merge two equal-length lists into a dictionary, mapping one-to-many
Lst1 = ['11', '13', '11', '12', '11', '13', '12', '12', '12', '13', '11']
Lst2 = ['1/41', '1/34', '1/37', '1/47', '1/41', '1/33', '1/46', '1/45', 'p4', 'p5', 'p6']
Dict1 = {'11': ['1/41', '1/37', '1/141', 'p6'],
'12': ['1/47', '1/33', '1/46', 'p4'],
'13': ['1/34', '1/33', 'p5']}
Dict1 = {}
for key, val in zip(Lst1, Lst2):