May 24, 2020
Pierre-Auguste Renoir, Luncheon of the Boating Party, 1881
After forgetting yet another birthday, I decided to set up a simple daily email reminder system. It sends me an email every day of all the birthdays coming up in the next few days.
The automation is done using GitHub Actions. It consists of a small Python program and the emails are send using Sendgrid’s API. Due to the low volumes, all the services used - are on FREE plans.
Since setting it up, I have added some forex and stock price information into the daily mail. The code is included in the GitHub repository but can be commented out if not used.
daily_mail.py- Python program
.env- Environment variables used by the Python program
birthdays.csv- List of birthdays and anniversary - csv format
.github/workflows/pythonapp.yml- GitHub Actions setup file
birthdays.csvfrom the GitHub repository above
pip install environs requests sendgrid
get_stock_html()in the python file
def main(): html_content = \ # get_forex_html() + \ # get_stock_html() + \ get_birthday_html()
.github/workflows/pythonapp.ymlfile is to set the time when the program will execute. In the file below, it executes daily at 6h UTC. Use crontab guru as a guide if you are not to speed with the cron parameters
# Send daily emails - time in UTC (GMT) name: The Daily Mail on: schedule: - cron: '0 6 * * *' jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Set up Python 3.7 uses: actions/setup-python@v2 with: python-version: 3.7 - name: Install dependencies run: | python -m pip install --upgrade pip pip install environs requests sendgrid - name: Send email run: python ./daily_mail.py
Total runtime on GitHub is about 30 seconds. On the GitHub free plan, you have 2,000 Actions minutes/month available. So no problem there.
Maintaining the birthday file
I used standard csv file format rather than yaml, json or any other. This is so that I can maintain the list easily on my local machine using Excel. It also displays nicely on GitHub.
birthday,age,name,note 2020-06-21,once,Father's Day,Ireland 2021-06-20,once,Father's Day,Ireland 2022-06-19,once,Father's Day,Ireland 2020-05-26,45,Adrian Bruce,birthday 1964-05-27,0,Alexander MacDonald,birthday
birthday- Must be in
age- You can enter the age of the person on the specified date. Make this 0 if date of birth was entered. This is used to show the calculated age of the person in the email. If age of person is unknown , leave the
agefield blank. Where the
agefield is blank, the year field of birthday is ignored. For once-off reminders or events, add the word
agefield. The reminder will only be shown on date indicated.
Solving the Jane Street puzzle of December 2022
Why I created Scrumdog - a program to download Jira Issues to a local database
Jane Street puzzle Feb 2021 SOLVED! OCaml to the rescue
Solving the Jane Street puzzle of Dec 2020 - Backtracking with OCaml
Automate your Jira reporting with Python and Excel
Solving the Jane Street Puzzle of June 2020; Circle Time