Donald Trump Got Me a DevOps Job
Trump Got Me A Job In DevOps
This is a true story about how I got a DevOps position on a team with some great people thanks to Donald Trump!
Let’s start with the back story…
I have an obsession with collecting domain names. Like a lot of Linux SysAdmins or devs that are actually passionate about their field, I occasionally frequently have ideas for some amazing website or app that will make the world a better place and make me rich at the same time.
That’s why I own PoopingAtWork.com, AlGoreInventedTheInternet.com, tctuggers.com, and about 30 others.
Sometimes I find time to start the project but I rarely have time to finish it and it will just sit there with a parking page. My intentions are good though. The idea usually comes to me when something pisses me off.
Here are just a few examples of domain names I have purchased to solve a problem that personally impacted me.
Domain Name | Problem I thought I could solve |
---|---|
TheDundies.com | This is probably one of the only sites I’ve built that I use on a regular basis. It’s very handy for finding a quote from The Office and sending to a friend. The link will unfurl in Slack or iMessage and reveal the quote. You don’t even need to click most times unless the quote has been shortened due to length. |
BadAtParking.com | People park like idiots. The idea here was to take a picture of them and it would go on a website to shame them. I built a Bash script that generated a new static site every time I added a photo to a directory on one of my Raspberry Pis. After that it would upload the newly generated HTML to an S3 bucket. I did this for about 2 years but wasn’t skilled enough to make it look decent at the time. Now it’s just parked until I can get back to it. |
BadAtDriving.com | Pretty much the same story as above. |
LeftLaneLaw.com | Why don’t you stop camping out in the left lane while you drive on the highway? It’s for passing people! You are the reason traffic sucks. This used to redirect to a YouTube video about how people that do this make the roads a terrible place. |
ScratchOnTheBreak.com | I used to play pool pretty frequently. People who don’t know the real rules think that you lose the game if you scratch on the break. It’s happened so many times that I needed a website; one that they would never suspect is mine. |
The point here is that I love collecting domain names. I know it sounds ridiculous but it’s how I operate and I’ve gotten much better about it in the last couple years.
That’s about all you need to know to understand the rest of the story.
Covfefe
On May 30, 2017, I woke up and checked Reddit followed by Twitter like I usually do. Twitter was going crazy about something that Donald Trump said!
He tweeted, Despite the constant negative press covfefe
.
After poking around the Twitterverse for a bit watching all of the people get so excited about something that meant so little, I rushed to AWS Route 53 to purchase covfefe.com. Shit, someone beat me to it.
I was a little pissed but the day must go on! I took a shower, got ready for my DevOps job and went to work.
After getting settled in at work it was still kind of bothering me. I checked the whois
registry to find that someone purchased it about 2 hours before I had even woken up. Nothing I could have done.
About a week or two later, I saw news that the buyer of covfefe.com had listed it on an auction site. It had already received bids over $3k. This raged me out a bit. That should have been mine. How do I solve this problem?
Trump is a loose cannon. He says crazy shit all the time. I’m not taking a political stance here. These are just facts.
There is a 100% chance that he will do this again. It might not blow up like covfefe did but I should still be prepared!
DevOps
As I mentioned earlier, I was already a DevOps engineer at this point in my career. I had transitioned from a Linux SysAdmin about a year before. They asked me to apply for the DevOps job because I was constantly scripting and automating everything. That’s what I enjoy doing.
Everyone has a different definition of DevOps. I’m not here to talk about who is right or wrong. A big part of most DevOps positions is stringing a bunch of unrelated shit together to make something happen.
The “problem” of not being able to buy Donald Trump domain names while I am sleeping could easily be solved with Python scripts and DevOps tools—a lot of the tools I was familiar with already. Some of them I used every day at work.
Let’s do it! I set out to build Trump_Bot.
I am a big fan of Jenkins and already had it running in my homelab.
The first thing I needed was a script to check for Trump’s new tweets. This was what I came up with.
I’ll explain the scripts after each one so you don’t have to read any code. That’s not what this is about. It’s a story. Also, no judging my code from years ago!
# script to check and parse trump tweets
from twython import Twython
import os
import re
import sys
consumer_key = 'xxxxxxxxxxxxxxx'
consumer_secret = 'xxxxxxxxxxxxxxx'
access_token = 'xxxxxxxxxxxxxxx'
access_token_secret = 'xxxxxxxxxxxxxxx'
twitter = Twython(consumer_key, consumer_secret, access_token, access_token_secret)
last_tweet_id_file = 'tweet_checker/last_tweet.txt'
bad_word_list = ['http', 'rt', '@']
word_list = []
# write contents of tweet to file.
def write_last_tweet_id(last_tweet_id):
handle = open(last_tweet_id_file, "w")
handle.write(last_tweet_id.encode('utf-8'))
handle.close()
# read contents of last tweet id file
def read_last_tweet_id():
handle = open(last_tweet_id_file, 'r')
last_tweet_id = handle.read()
handle.close()
return last_tweet_id
# clean the word and add to list
def clean_word(word):
word = re.sub('[^a-zA-Z0-9]', '', word)
print 'running clean_word(%s)' % word
word = re.sub('[^a-zA-Z0-9]', '', word)
if not any(bad_word in word for bad_word in bad_word_list):
print word
word = word.lower()
print word
print 'adding "%s" to word_list\n' % word
word_list.append(word)
else:
print 'NOT adding "%s" to word_list\n' % word
# remove empty strings from list
def clean_word_list(word_list):
word_list = [word for word in word_list if word != '']
return word_list
# get tweets and make a list of words
def get_tweets():
last_tweet_id = read_last_tweet_id()
print 'last_tweet_id is %s' % last_tweet_id
user_timeline = twitter.get_user_timeline(screen_name="realdonaldtrump", since_id=last_tweet_id)
count = len(user_timeline)
if count == 0:
print 'No new tweets. Exiting.'
os._exit(0)
# get tweets since last check
for tweet in user_timeline:
# get data from tweet
current_tweet_id = tweet['id_str']
tweet_text = tweet['text']
# write last tweet id to file if it is the last one
count -=1
if count == 0:
write_last_tweet_id(str(current_tweet_id))
# split tweet text into words
for word in tweet_text.split():
# clean word and add to word list
word = clean_word(word)
def check_domains(word_list):
word_list = clean_word_list(word_list)
for word in word_list:
domain_name = "%s.com" % word
os.system("python domain_checker/domain_checker.py %s" % domain_name)
get_tweets()
check_domains(word_list)
Every tweet on Twitter has a tweet_id; I saved his most recent tweet to a file and committed it to a Git repo. The script checks out the file and then uses the Twitter API to see if @realdonaldtrump has any tweets that came after the tweet_id that I saved.
For each new tweet, I removed special characters, garbage (like RT and https), and any other words I knew I didn’t want in a domain name. I separated each word and added it to a list.
The next step was to check each word to see if the domain name was available.
That script runs the word list through another script.
Before any of you smart internet people DM me: Yes. I know I shouldn’t have used os.system for this. The code is old. I was still very new to Python but I was having fun. We all started somewhere. I could have fixed this and many other issues but I posted it here for you to see. Just deal with it.
import json
import requests
import urllib
import sys
from twilio.rest import Client
try:
arg_count = len(sys.argv)
domain_name = str(sys.argv[1])
except:
print("This script only accepts 1 arg. Try again.")
exit()
#################
# godaddy creds #
#################
api_token = 'xxxxxxxxxxxxxxx'
api_secret = 'xxxxxxxxxxxxxxx'
url = 'https://api.ote-godaddy.com/v1/domains/available?domain=%s&checkType=FAST&forTransfer=false' % domain_name
################
# twilio creds #
################
account_sid = 'xxxxxxxxxxxxxxx'
auth_token = 'xxxxxxxxxxxxxxx'
client = Client(account_sid, auth_token)
my_phone = '+15555555555'
def send_text(to, message):
client.messages.create(to=to, from_="+1555555555", body=message)
def check_args():
if arg_count != 2:
exit()
else:
print 'Checking for %s' % domain_name
check_domain()
# check if domain name is available
def check_domain():
headers = {'Authorization': 'sso-key xxxxxxxxxxxxx_xxxxxxxxxxxxx:xxxxxxxxxxxxx'}
resp = requests.get(url, headers=headers)
try:
available = resp.json()['available']
except:
print '\n#### something went wrong ####'
print '%s' % url
print '##############################\n'
# if domain is available, send text message
if available is True:
message = '#### %s is available ####' % domain_name
send_text(my_phone, message)
check_args()
In that script, I used the GoDaddy API to check if the domain was available. After that step, the best idea would be to buy the domain automatically. Right?
No. Not with Donald Trump steering the ship. I could take a nap and potentially wake up to a $400 bill just because some guy had a temper tantrum. I needed a way to test it out first.
I could have just written them to a file and checked it every few days but that is boring. I grabbed an account at Twilio and used their REST API to send myself text messages when the domain name was available.
I added the scripts to Jenkins and scheduled it to run every five minutes.
Most common words in domain name form are taken, right?
False Trump_Bot found quite a few that were not taken. It wasn’t a firehose of text messages but it was far more than I expected. Nothing too interesting or fun though. Just random garbage words that some company will eventually buy.
Around this same time, my wife and I got tired of living in Denver. Denver traffic sucks. Denver weather sucks. Denver cost of living sucks. Denver roads suck. Denver drivers suck. Denver companies indefinitely pretending they are a startup in California suck.
You may have guessed this already but I purchased the 3 domain names that had to do with cars and driving while living in Denver. Enough about that though.
We wanted to move back to the 110ºF weather in Phoenix. I checked the box on LinkedIn to let recruiters know that I was looking for opportunities.
Have you ever eaten at a fast food restaurant with an outside dining area? You know how all the annoying birds (seagulls/pigeons) swarm in once you drop a french fry on the ground?
That’s what checking the Open to Opportunities
box on LinkedIn is like. Countless recruiters spamming you with bullshit that doesn’t fit your skill set at all!
It went a lot like this…
I see that you wrote Python scripts in your SysAdmin position. Checkout this amazing opportunity to be a .net developer! You’re a perfect fit.
How would you like to quit your full-time position for a part-time contract job as a desktop support person?
After a couple days of filtering through garbage, I had a lead on a position I thought would be good for my skill set.
I updated my resume with my current job and submitted it.
The Interview
A few days later I had a company recruiter email me to do a technical assessment and then again a day later to set up an interview over Skype.
I logged in and met with the people that could potentially be my new team. They seemed like a fun group and the manager seemed like a real person.
I’m a big fan of real people. It’s very important to me to work with people who aren’t constantly putting on a show (like most people on LinkedIn).
The interview went pretty well. We talked about nerd hobbies, past jobs and joked around a bit. I had similar hobbies to some of the members. I wanted to work on this team.
We parted ways after an hour of chatting but I had a good feeling about this one.
Donald Trump Gets Me A Job In DevOps
I got an email from the manager shortly after.
Hi Tyson,
I was wondering if you would be kind enough to send over an example or two of your shell or Python scripts. We script all day long over here and it’s important for our team to be an expert resource for anyone that needs help.
Thanks and it was great talking to you!
Uh oh! What should I send?
I’d be crazy to submit Trump_Bot as a code sample for an interview…
Pshh. I like to party. Send it!
To be honest, I wasn’t really worried about it. The team I met over Skype really didn’t seem like the type to get offended over nothing. If they got mad about this, I probably don’t want to work with them anyway.
I replied with a zip file containing Trump_Bot, which was three separate scripts at the time. I let them know that the intention wasn’t to be political and then told them the story you read about at the beginning of this article.
I attached a couple of Python scripts that I wrote a few weeks ago.
Here is the back story…
I like to waste money on domain names for stupid ideas that I have no time to pursue. This story isn’t political. It’s just me having fun.
A month ago Donald Trump made a spelling error while tweeting, resulting in “covfefe”. I tried to buy covfefe.com but I was a few hours too late because I was sleeping.
I decided to make my home Jenkins server do the work for me so it could never happen again. I wrote a script using the Twitter API that checks his Twitter feed every single minute. It checks out a Git repo with a last_tweet.txt file.
If he has any tweets since that last tweet, it will parse out every single word and uses the GoDaddy API to see if the .com is available. If it is available, Jenkins launches another script that uses the Twilio API to send me a text message and let me know. After that it updates the last_tweet.txt file to reflect the newest tweet and then pushes back to Git.
I could let the script loose and just buy the domain name for me but I am a bit scared to let a Twitter account automatically pick what domain names I purchase.
Great talking to all of you. Enjoy!
As I’ve mentioned, the code wasn’t amazing, but it was creative. I was still feeling good about this. Exactly 20 minutes later I got a reply from the manager.
Thanks Tyson!
I can’t write down the words I just used out loud to describe how awesome this is because it isn’t work appropriate. Professionally this demonstrates a fantastic use of Jenkins projects combined with scripting, REST APIs across multiple industry leaders, repositories properly used for change control and audit history, and automated SMS alerts.
On the other side of the professional coin this demonstrates an amazing sense of humor and I’m sad I didn’t think of something like this. I’m still giggling.
I couldn’t believe it. It actually worked. Donald Trump got me a job in DevOps.
A few days later I got a call from the company recruiter to start low-balling offers and lie about yearly bonuses to make it official. I accepted and moved back to Arizona with my wife.
I never ended up buying any of the domains that I found. I never re-enabled the Trump_Bot Jenkins job after moving back to Phoenix. It was just way too noisy with very little payoff, other than the job it got me.
I worked with that core team for about two years before people started going their separate ways. I learned a lot and made some great friends! 10 out of 10, would do again.
Thanks Donald Trump, you’re the best!