Skip to content

Instantly share code, notes, and snippets.

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,
@dr-alberto
dr-alberto / linear_dependency.py
Created November 28, 2020 21:58
Check the linear depencency of two vectors using Numpy
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)