Skip to content

Instantly share code, notes, and snippets.

@89465127
89465127 / README.md
Last active December 19, 2015 03:08 — forked from rduplain/README.md

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

Host: Linux Mint 15 x86_64

Install:

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

In /etc/odbcinst.ini:

import paramiko
class SSH():
def __init__(self, host, key_file, user="root"):
''' Open up a SSH connection using paramiko '''
key = paramiko.RSAKey.from_private_key_file(key_file)
self.client = paramiko.SSHClient()
self.client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
self.client.connect(hostname=host, username=user, pkey=key)
rsync -avz /path/to/local/sync/folder -e "ssh -i /path/to/ssh/key" ubuntu@ec2instance:/path/to/remote/sync/folder