. ? + * ^ $ \
( ) [ ] { } | Need to be escaped with a backslash () to match the actual character
- Any other character matches itself
. Matches one of any character
(...) Groups elements into a single element (also captures contents)
| import json | |
| import re | |
| def extract_json(text): | |
| maybe_match = re.search('({.*:.*})', text) | |
| if maybe_match: | |
| match = maybe_match.groups(1)[0] | |
| return json.loads(match) | |
| return {} |
| import base64 | |
| import urllib.request, urllib.parse, urllib.error # for url encoding | |
| import urllib.request, urllib.error, urllib.parse # for sending requests | |
| from http.client import IncompleteRead | |
| from ssl import SSLError | |
| import io | |
| import logging | |
| import gzip | |
| import shutil | |
| import time |
| // XPath CheatSheet | |
| // To test XPath in your Chrome Debugger: $x('/html/body') | |
| // http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/ | |
| // Credit to the original author: https://gist.github.com/LeCoupa/8c305ec8c713aad07b14 | |
| // 0. XPath Examples. | |
| // More: http://xpath.alephzarro.com/content/cheatsheet.html | |
| #!/bin/bash | |
| ###################################################################### | |
| # Useful script when you want to run `pip` in virtual environments # | |
| # you have in a common directory with a provided Python package. # | |
| # Note: Requires VirtualWrapper to be managing your environments # | |
| # # | |
| # Usage: # | |
| # ./pip_virtualenvs.sh [-i | -u | -z] pkg_name [-a | -l] [env1 env2] # | |
| # # | |
| # Example: # |