Skip to content

Instantly share code, notes, and snippets.

@mark5280
mark5280 / README.md
Created February 26, 2021 16:16 — forked from Paradoxis/README.md
Connect to MSSQL using FreeTDS / ODBC in Python.

Goal: Connect to MSSQL using FreeTDS / ODBC in Python.

Host: Ubuntu 16.04 x86_64

Install:

sudo apt-get install freetds-dev freetds-bin unixodbc-dev tdsodbc
pip install pyodbc sqlalchemy

In /etc/odbcinst.ini:

@mark5280
mark5280 / relative_to_absolute_urls.py
Last active July 21, 2023 13:03
A Python script to replace relative paths in src/href attributes in a HTML string with absolute path equivalents. Inspiration was provided by https://gist.github.com/sprintingdev/8843526. See additional notes below.
# In development of this script I had four goals:
# 1) Operate on a string fragment of HTML and assume it could be poorly formed (ie - might not parse well with lxml, etc.)
# 2) Ability to call the function with base_url since it would be used in the processing of multiple sites and HTML fragments
# from them
# 3) Desire to use urlparse.urljoin to insure that the resulting absolute url was well formed
# 4) Even if the HTML fragment contains absolute URLs I could pass it through this routine without issue
# Starting with https://gist.github.com/sprintingdev/8843526 I found that certain
# relative URLs would, when made absolute, were not always well formed. Often there
# could be multiple slashes in the URL path. To combat this urlparse.urljoin was introduced.