Skip to content

Instantly share code, notes, and snippets.

View Ch3mjor's full-sized avatar
💭
To be or not to be. That is the question.

Collins Ch3mjor

💭
To be or not to be. That is the question.
  • Nairobi
View GitHub Profile
@Ch3mjor
Ch3mjor / email_sender.py
Created August 28, 2019 08:43
Automated Sending of emails Python3 with Attachments (new file each new day)
#Code by Collins Chemjor
import os
import smtplib
from email.message import EmailMessage
from datetime import date
#Setting email address and password to be used
EMAIL_ADDRESS = os.environ.get('EMAIL_USER')
EMAIL_PASSWORD = os.environ.get("EMAIL_PASS")
@Ch3mjor
Ch3mjor / Excel_Python.py
Created June 10, 2019 14:49
Get information from one column in one sheet and match it to another column in another sheet, and extract it as a csv file.
import xlrd
from csv import writer
def file_writing(client):
#Function to write client details to a csv file (later to import into excel)
with open("clients.csv", mode = "a") as file:
csv_writer = writer(file)
csv_writer.writerow(client)
@Ch3mjor
Ch3mjor / Regex_character_replace.py
Created June 10, 2019 10:03
Python Regex Expression to remove special characters (,) and (')
#This is code to remove "," and "'" in code
#importing regex module
import re
#Final Storage array
final_name = []
#Defining our regex that will remove commas(,) and apostrophes('), however it will ignore spaces
#This is a test / example code, replace with your own
names = ["Cow","Chick'en", "Crick,et", "Bu'll", "She,e,p"]
#The regex
@Ch3mjor
Ch3mjor / jokes.py
Last active June 7, 2019 09:48
A python script to get jokes from icanhazdadjoke.com
#Code to scrape https://icanhazdadjoke.com/
#It will generate one joke from terminal
#You need to install the following modules: requests, bs4, pyfiglet and termcolor (You can use pip)
import requests
from bs4 import BeautifulSoup
from random import choice
from pyfiglet import figlet_format
from termcolor import colored
value = ""