Skip to content

Instantly share code, notes, and snippets.

@dr-alberto
dr-alberto / linear_dependency.py
Created Nov 28, 2020
Check the linear depencency of two vectors using Numpy
View linear_dependency.py
import numpy as np
from scipy.linalg import lu
def linearly_dependent(x, y):
if len(x) == 2 and len(y) == 2:
matrix = np.array([x, y]).T
return np.linalg.det(matrix) == 0.0
else:
matrix = np.array([x, y])
_, u = lu(matrix, permute_l=True)
View Readmail.py
def readmail(volume):
time.sleep(1.5)
m = imaplib.IMAP4_SSL("imap.gmail.com")
m.login(user, pwd)
m.select('"[Gmail]/All Mail"')
resp, items = m.search(None,
"NOT SEEN FROM tradingview")
items = items[0].split()
for emailid in items:
resp, data = m.fetch(emailid,