I've added comments!

Published on 09/20/19 at 00:02 EST by Max Bridgland


You can now add comments to my blog posts!

Go ahead... try it out!

There is a filter of course and ReCaptcha so don't try anything tricky ;)

Markdown supported in comments although I haven't tested it extensively. Hope you guys give me some feedback on my posts now!


Sending Text Messages From An E-Mail With Python

Published on 09/19/19 at 01:14 EST by Max Bridgland


This is the method I use for my 2FA to not have to use Twilio or anything else. This is free except for the fact I'm using an enterprise domain email hosted on G-Mail.

Here is my send_sms function:

import smtplib
from email.message import EmailMessage
from app import app

mail_settings = {
    "MAIL_SERVER": 'smtp.gmail.com',
    "MAIL_PORT": 465,
    "MAIL_USE_TLS": False,
    "MAIL_USE_SSL": True,
    "MAIL_USERNAME": '[email protected]',
    "MAIL_PASSWORD": 'password-here',
    "MAIL_END": '@tmomail.net' # TMobile Email
}

def send(message):
        # Replace the number with your own, or consider using an argument\dict for multiple people.
    if app.testing:
        to_number = '555-555-0000{}'.format(mail_settings['MAIL_END'])
    else: # pragma: no cover
        to_number = 'XXX-XXX-XXXX{}'.format(mail_settings['MAIL_END'])
    auth = (mail_settings['MAIL_USERNAME'], mail_settings['MAIL_PASSWORD'])

    # Establish a secure session with gmail's outgoing SMTP server using your gmail account
    server = smtplib.SMTP( "smtp.gmail.com", 587 )
    server.starttls()
    server.login(auth[0], auth[1])
    msg = EmailMessage()
    msg.set_content(message)
    msg['Subject'] = " "
    msg['From'] = "Me!"
    msg['To'] = to_number
    server.send_message(msg)
    # Send text message through SMS gateway of destination number

Using Redis as a JSON Store in Python

Published on 09/18/19 at 13:49 EST by Max Bridgland


Converting this blog to Redis was extremely easy! I was able to simply convert my existing JSON data into Redis JSON objects in under 2 hours. Here is a short tutorial:

import json
import redis

db = redis.StrictRedis(....)

# To Create A JSON Store

>> db.set('key', json.dumps({'test1': 'value1'})
True

# To Grab That JSON Store

>> byte_obj = db.get('key')
>> py_obj = json.loads(byte_obj)
>> print(py_obj)
{'test1': 'value1'}

See how simple it is to use JSON with Redis? I was so happy when I found out :P - Max


Testing New Redis Database!

Published on 09/18/19 at 11:44 EST by Max Bridgland


This post is just a test for my redis database! If you can see this redis is working :)


Quick test to see if I fixed my blog :P

Published on 10/22/19 at 00:26 EST by Max Bridgland


How yall doin?