Brad's Blog

web dev, django, running, food, or whatever

What's in my requirements.txt 2017-05-14

It's Sunday, and tomorrow is our scheduled monthly python meetup in Memphis, and it's one of those month's where I've been busy and I haven't done a good job of finding a speaker. So, that mean's I've got to pull something together at the last minute. While racking my brain for a quick-and-easy topic, I thought, "I wonder what python packages I'm using most?" So, I ran this nifty monstrosity of a command, and here's the results. I also tweeted ...

The Blue Collar Programmer 2017-02-12

There's a recent Wired article that's been floating around the web that asks if computer programming is the next big thing in blue collar work. I find this article interesting, because I've long though about computer programming a skilled trade. In one sense, it's not unlike being a plumber or and electician, both of which can provide very decent, middle-class salaries. In fact, thinking of tech jobs in this manner is nothing new! In the '90s every vocational college in ...

Sending SMS messages with Amazon SNS and Python 2017-02-01

There are many services out there that will let you programmatically send SMS messages. One of the more popular is Twilio, and they have a great API and a python client that's easy to use. There's an interesting quora thread with several other suggestions as well. Another option is to use Amazon's Simple Notification Service (SNS), which also supports sending SMS messages. I recently incorporated this into a project, and thought I'd share. Step 1: API key + boto3 If ...

Why is runserver/daphne so slow? 2017-01-03

(tl;dr) I installed django-channels and now my runserver command is very very slow. django-debug-toolbar was sort of the culprit (not really, because it was my own fault) The problem I've just started a new project using django-channels. Websockets + channels is incredibly powerful, but I noticed something strange: While running django in debug mode, the development server was incredibly slow (on the average of 60s-90s per response). After a bit of digging, it seemed that django-debug-toolbar was to blame, so ...

2016 St Jude Memphis Marathon 2016-12-10

It's been exactly one week since I participated in the St. Jude Memphis Marathon, and I wanted to take a moment to say thank you to everyone who helped me get so close to my fundraising goal. Together, we raised $1435 of $1500, and I'm really happy about that (although, you can still give up 'till January!). As for the race, well... I'm glad I ran it. This year, I've run a 50k, a 50-miler, and this marathon. Unfortunately the ...

Help me support St Jude 2016-05-21

If you've known me for a while, you might know that I'm a runner. Since I live in (near) Memphis, TN it's hard not to get excited about the St Jude Memphis Marathon. Surprisingly, this will only be my second marathon, and this year I've decided to run the race as a St. Jude Hero. What's a St. Jude Hero? Well, I've pledged to raise at least $1500 in donations for St. Jude, and I need your help! I've got ...

Let's convert a Word Doc to HTML 2016-04-29

tl;dr I wrote a python script to convert Word documents to mostly-clean html. Get it at https://github.com/bradmontgomery/word2html. Ah, Microsoft Word... That glorious business-class software used all-around the world. It's perfect for those long, legal documents consisting of nothing but headers, paragraphs, and bulleted lists. All of which we an easily convert into simple HTML, right. Right? File > Save As > Web Page (.htm). Easy as... No wait, was that supposed to be File > Save As > Web Page, ...

50 miles 2016-03-11

Saturday, March 5, 2016. I woke up around 4:30am, and we drove out into the middle of nowhere in southern Mississippi. We arrived around 5:30am, and people were already lining up for the 6:00am start. It was 40°F, but the high for the day was supposed to hit the low-mid 70's. This was the Mississippi Trails 50. I'd run my first 50k in mid-January, but this was my first attempt at a 50-miler—a staple of the ultra-marathon trail run. The ...

Young Coders at PyTennessee 2016 2016-02-08

On February 6, 2016 I had the pleasure of teaching the Young Coders class at PyTennesse. It was an incredibly fun and rewarding experience, and I'm looking forward to doing this again at some point in the future. The class We had ten young coders ranging in ages from 12 to 17, and spent most of Saturday morning quickly plowing through examples of using python as a calculator, exploring data types like integers, floats, strings, and lists. We kicked things ...

Ignoring SuspiciousOperation requests for fun and (profit?) 2015-12-16

If you run a Django site, you're probably familiar with those periodic emails due to a SuspiciousOperation exception; it happens when your site receives a request that contains a host header that's now found in the ALLOWED_HOSTS setting. Yes, they're annoying, and while it's good to know when this happens, I've found that there will typically be one or two requests that you get frequently (I'm looking at you, request for /azenv.php from check.proxyradar.com). In these cases, I think it's ...