Skip to content

Instantly share code, notes, and snippets.

@jthop
jthop / ses.py
Created November 10, 2018 13:24
#Send email via ses using boto3
import boto3
REGION = 'us-east-1'
TO = ['test@test.com']
TEXT_BODY = 'testing 1 2 3'
HTML_BODY = 'html body'
SUBJECT = 'boto'
@jthop
jthop / logging.py
Last active November 10, 2018 13:22
#Simple Python logging to syslog
import logging
import logging.handlers
my_logger = logging.getLogger('MyLogger')
my_logger.setLevel(logging.DEBUG)
handler = logging.handlers.SysLogHandler(address = '/dev/log')
my_logger.addHandler(handler)

Keybase proof

I hereby claim:

  • I am jthop on github.
  • I am jthop (https://keybase.io/jthop) on keybase.
  • I have a public key whose fingerprint is 1732 26FC 110E 7B32 3F48 C206 E30B 4EB8 DE77 ADE8

To claim this, I am signing this object:

@jthop
jthop / oil_symbol.py
Last active October 6, 2015 19:37
Generate front month WTI symbol to use with yahoo quotes
import datetime
import pytz
OIL_SYMBOL = [None,'F','G','H','J','K','M','N','Q','U','V','X','Z']
FUTURES_CLOSE = [20, 20, 20, 22, 22, 21, 20]
MONTHS = [None, 'JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL',
'AUG', 'SEP', 'OCT', 'NOV', 'DEC']
def _form_oil_symbol():
"""Form cruide oil futures symbol that is currently trading"""
@jthop
jthop / Pagination.py
Last active August 9, 2018 12:44
Simple python pagination class
class Pagination(object):
def __init__(self, page=1, page_size=100, count=0, sides=5, args={}):
self.page = page
self.page_size = page_size
self.sides = sides
self.count = count
self.args = args
self.args['count'] = self.count
#algo to get 3/2 = 2