Skip to content

Instantly share code, notes, and snippets.

View LiYChristopher's full-sized avatar

Christopher Li LiYChristopher

View GitHub Profile
@LiYChristopher
LiYChristopher / async_mail.py
Last active February 22, 2023 17:39
SendGrid v3 Mail Send - Async Example
import sendgrid
from sendgrid.helpers.mail import *
import os
import asyncio
sg = sendgrid.SendGridAPIClient(
apikey=os.getenv("SENDGRID_API_KEY")
)
@LiYChristopher
LiYChristopher / docker-time-sync-agent-py3.sh
Last active May 11, 2017 18:23
arunvelsriram/docker-time-sync-agent - Py3
#!/bin/bash
set -e
latest_release_tag() {
curl -s https://api.github.com/repos/arunvelsriram/docker-time-sync-agent/releases/latest \
| python -c "import sys, json; print(json.load(sys.stdin)['tag_name'])"
}
echo_me() {
echo
@LiYChristopher
LiYChristopher / attachments.py
Created April 3, 2017 19:35
Pseudo-code for Sending Attachments
'''
Pseudo-code example of sending an attachment via SendGrid's API lib. This assumes that
you're using one of our coding libraries with helper methods (though this is more or less a Python library example)
'''
import sendgrid
from sendgrid.helpers.mail import *
import datetime
import base64
mail = Mail()
@LiYChristopher
LiYChristopher / operations_timed.py
Created April 12, 2016 03:51
A simple plot depicting the speeds of different Python operations to achieve results of this task - list of squares of an array of numbers
import timeit
import matplotlib
from matplotlib import pyplot as plt
comp_setup = '''def comp_time(num):
return [i**2 for i in range(num)]
'''
loop_setup = '''def loop_time(num):
res = []
for i in range(num):