Skip to content

Instantly share code, notes, and snippets.

@OnePro
OnePro / email.py
Created June 24, 2020 18:44
Python Emailing examle
class Email:
def __init__(self, receivers, subject='', body='', files=None):
self.sender = EMAIL_SENDER
self.receivers = receivers
# Create the message
msg = EmailMessage()
msg['Subject'] = subject
msg['To'] = ', '.join(receivers)
msg['From'] = self.sender
msg.set_content(body)
from concurrent import futures
from random import randint
import time, os, math, logging, logging.handlers, pprint
import multiprocessing
formatter = logging.Formatter('[%(asctime)s] - %(name)s - %(levelname)s - %(message)s')
cons_log = logging.StreamHandler()
cons_log.setFormatter(formatter)
handler = logging.handlers.WatchedFileHandler('status.log')
handler.setFormatter(formatter)
@OnePro
OnePro / good_code.js
Last active September 11, 2019 00:00
JS code for example
/**
* This is the detail about the constructor
* @class Main class for all books
* @param {String} title Book title
* @param {String} author Name of author
* @param {Number} pages How many pages in the book
*/
class Book {
constructor(title, author, pages) {