Skip to content

Instantly share code, notes, and snippets.

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 Aug 28, 2019
Automated Sending of emails Python3 with Attachments (new file each new day)
View email_sender.py
#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 Jun 10, 2019
Get information from one column in one sheet and match it to another column in another sheet, and extract it as a csv file.
View Excel_Python.py
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 Jun 10, 2019
Python Regex Expression to remove special characters (,) and (')
View Regex_character_replace.py
#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 Jun 7, 2019
A python script to get jokes from icanhazdadjoke.com
View jokes.py
#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 = ""