Custom Hallway Pullup Bar


So I wanted a pull-up bar in my house but I’ve always hated those doorframe pull-up bars you get at Target. They are too short for me to hang from and not have my feet dragging on the ground. They don’t feel very sturdy to me and they can damage your door and walls. Oh and they are ugly.

Project Requirements

I always start a project with my requirements. That will help me come up with a design and some constraints.

  • Solidly supports my weight for pullups
  • Doesn’t block the doorway
  • Tall enough for me to hang from without my feet touching the ground
  • Not obtrusive / isn’t obviously visible


  • 3/4” Plywood (I used Baltic Birch)
  • 3/4” Galvanized Steel Pipe
  • Long Wood Screws
  • Tung Oil (or whatever finish you want)

Required Equipment

  • Jigsaw
  • Drill
  • Hole Saw
  • Studfinder
  • Hack Saw
  • Sandpaper
  • Measuring Tape
  • Level
  • File


For the pull-up bar design, I’ve decided to mount two boards on either side of a hallway with a metal bar that sit in a slot just using gravity. The bar can sit at different heights and positions and and can be removed and replaced if need be. I decided to go wit baltic birch because it looks clean and minimal.



  1. Decide where you’re gonna want the pull-up bar. Make sure it’s somewhere where you have enough head clearance to do a pull-up. Mark off where the studs are using the studfinder.

  2. Based on where the studs are relative to the wall you can figure out how long the boards need to be to hit two studs. For me there were studs at about 14” inches from the doorframe, so I made my wooden brackets 17” inches long so there was some meat between the supported part of the board and the edge.

  3. Mark the boards out and cut them using a jigsaw, tablesaw, chopsaw or whatever you have.

  4. Use the hole saw with the drill to remove the hole from where the pull-up bar will go.

  5. Then use the jigsaw to cut a slot from the board edge to the hole.


  6. Sand everything nice and smooth.

  7. After making sure to remove any sawdust residue, wipe the tung oil on in a thin layer and let dry.

  8. Repeat Step 7 twice more to get a thicker finish.

  9. Attach the boards into the wall making sure everything is level across the hallway. Use at least three screws in a stud. Please make sure everything is good and secure.

    one board mounted

  10. Using the hacksaw, cut the steel pipe so it just fits between your walls. This will ensure as much pipe as possible is supported by the wood brackets. File the pipe down on the ends to remove any burrs in the steel.


  11. Put your steel pipe up between the two boards and you have your pull-up bar!

    all done

There you have it

If you have a narrow enough hallway you too can have a custom pullup bar. I’m really happy with this design. It was inexpensive, it’s out of the way and it meets all my design requirements.

Most importantly, it holds my weight just fine!

And there it is, a custom, hallway pull-up bar. Thanks for reading. animation

Vocal Arrangements

Since 2007, I’ve been creating multi-voice arrangements for the a cappella groups that I’ve been involved in. All of these arrangements were created by me (sometimes with the help of friends) for non-commercial purposes. These songs have been sung by Take it SLO in San Luis Obispo, California and Seatown Sound in Seattle, Washington. Please feel free to download, alter, and reproduce my works. If you would be so kind as to credit the original artist and myself that would be just peachy.

I have in the past done works for other groups with a small commission. If interested, please contact me.

*Still in current repetoire

Everyday a cappella

(As if there was anything but)

Song Original Artist Parts
Bottom of the River Delta Rae SATB
Dark Disney Medley of more villian/dark Disney Songs SATBB + male and female solos
Disney Medley   9-part mixed
Don’t Speak No Doubt SATB + solo
Eye of the Tiger/Chariots of Fire Survivor/Vangelis SATTBB + solo
Happy Ending Mika SATB + solo
I’m Yours Jason Mraz SATB + solo
Mykonos Fleet Foxes SATB + solo and 2-harmonies
Next Best Thing Nikki and Rich SATB + solo
Oh Darlin’* The Beatles SATB + M/F solo
Save the Hero Beyonce SATB + solo
Settle Down Kimbra SSATB + solo
Smile Michael Jackson 3-part girls
The Way I Am Ingrid Michaelson SATB + solo
Viva La Vida Cold Play SATB + solo
Winter Song Sara Bareilles and Ingrid Michaelson SAATB
Chicken Dance* Folk Song SATB
Havana* Camila Cabello SAB + solo
The Chain* Fleetwood Mac SATB
Y’did Nefesh Rabbi Elazar Azriki TTBB
You and I* Lady Gaga SATB + solo

Holiday Songs

Song Original Artist Parts
Ma’oz Tzur Traditional Chanukah Song SATB
Chanukah Jazz   SATB + solo
Ghostbusters Ray Parker Jr. SATB + solo
Thriller* Michael Jackson after BYU Vocalpoint SATB + solo
White Winter Hymnal Fleet Foxes SATB
I Put a Spell on You* a la Hocus Pocus SATB + solo

Build a Flask app for model serving

This post is modeled off a workshop I gave to the Seattle Building Intelligent Applications Meetup.

You can fork the code here Github Repo

What is Flask?

Flask is a web framework for Python. In other words, it’s a way to use python to create websites, web apps and APIs.

Create your Flask Environment

I will be showing how to use flask with python 3 but python 2 should work just as well.

  1. Install virtualenv pip3 install virtualenv

  2. Set up the virtual environment virtualenv -p python3 venv3

  3. Activate the virtual environment source venv3/bin/activate

  4. Install the needed packages pip install -r requirements.txt

Flask App Organization

Flask has some basic requirements when it comes to file and folder structure.

# the most basic flask app
    | -

Here’s an example of a more complex folder structure you’d see if you were serving a more complete website.

# typical app structure
    | -
    | - static/
            | - css/
            | - resources/
            | - js/
    | - templates/
            | - index.html
    | - data/

Let’s build a basic flask app

  1. From the root directory, open your file, import flask and create your flask object.

     from flask import Flask
     # create the flask object
     app = Flask(__name__)
  2. Add your first route. Routes connect web pages to unique python functions. In this example, the root page of the site, yoursite/, should trigger the home() function and return ‘Hello World!’ as the server response to the webpage.

     # routes go here
     def home():
     return 'Hello World!'
  3. Now just add some code at the bottom to tell python what to do when the script is run.

     # script initialization
     if __name__ == '__main__':

    Note: debug=True allows for quicker development since you don’t have to keep restarting your app when you change it.

  4. Run python

  5. Check it out!

    Your Locally Running App

  6. Let’s add another route. Rather than just pure text, let’s return some HTML.

     def jazzhands():
         return "<h1>Here's some <i>Pizzazz!</i></h1>"
  7. One final route in our basic app. This route will use what’s known as dynamic routing. These allow more flexibility with your urls and the ability to pass variables straight through the url. Variables must be passed in between angled brackets ‘<>’ after the root of the url, in this case /twice/.

     @app.route('/twice/<int:x>') # int says the expected data type
     def twice(x):
         output = 2 * x
         return 'Two times {} is {}'.format(x, output)

Now let’s do some Data Science

We will be building a survival classifier using the Titanic Survival Dataset. Our goal is to create an interface for a user to make and view predictions.

The code to read in the data, split it up and train the model has already been written for you. We’re going to focus on how to implement the model and predict with it through the flask web interface.

Note: If you want more info on models for this dataset take a look here. Titanic Dataset Modeling

Install and import additional packages

  1. If you haven’t already done so, make sure you have all the required packages in your virtualenv.

     pip install pandas sklearn scipy
     // or 
     pip install -r requirements.txt
  2. Import the libraries required for modeling. render_template and request are needed for us to get data from the web interface to the flask app and then to present the results in a more visually appealing way than basic text.

     from flask import Flask     # you already should have this 
     from flask import render_template, request
     # modeling packages
     import pandas as pd
     import numpy as np
     from sklearn.linear_model import LogisticRegression
     from sklearn.model_selection import train_test_split
     from sklearn.metrics import classification_report
  3. Build the model: The following code will read in the titanic_data.csv, clean it up, select the pertinent features, split the data into test and training sets and then train a simple logistic regression model to predict the probability of survival. Paste this code right at the start of the script initialization. The model will be available in the namespace of the flask app.

     # read in data and clean the gender column
     if __name__ == '__main__':
         # build a basic model for titanic survival
         titanic_df = pd.read_csv('data/titanic_data.csv')
         titanic_df['sex_binary'] = titanic_df['sex'].map({'female': 1, 
                                                           'male': 0})
         # choose our features and create test and train sets
         features = ['pclass', 'age', 'sibsp', 'parch', 
                     'fare', 'sex_binary', 'survived']
         train_df, test_df = train_test_split(titanic_df)
         train_df = train_df[features].dropna()
         test_df = test_df[features].dropna()
         X_train = train_df[features]
         y_train = train_df['survived']
         X_test = test_df[features]
         y_test = test_df['survived']
         # fit the model
         L1_logistic = LogisticRegression(C=1.0, penalty='l1'), y_train)
         # check the performance
         target_names = ['Died', 'Survived']
         y_pred = L1_logistic.predict(X_test)
         print(classification_report(y_test, y_pred, 
         # start the app
  4. Rerunning the script now should show us the classification_report from the logistic regression model in the terminal. We haven’t hooked up any flask routes to the model however. Let’s change that.

Rendering HTML templates using Flask

  1. I’ve created a basic HTML template where we can build a user interface for predicting with our amazing model.

     def titanic():
         return render_template('titanic.html')
  2. Go to the Titanic Template to see where you will be interfacing with the user.

Hooking it all up

Getting prediction inputs into flask

Our model uses the following variables to predict whether someone would have survived the titanic:

  • Ticket Class (categorical)
  • Age (integer)
  • Number of Siblings & Spouses (integer)
  • Number of Children & Parents (integer)
  • Ticket Fare (numerical)
  • Gender (binary)

In order to hook up the web interface with the model we have to allow the user to input all of the required model parameters. The easiest way to do this is with a simple web form.

  1. In the titanic.html file, add the following code. This creates our webform, labels the inputs so we can grab them later and implements the predict button that sends the form to the /titanic flask route.`
     <!-- The web form goes here -->
     <form action="/titanic" method="post" id="titanic_predict">
             <label for="name">Ticket Class: 1, 2, or 3</label>
             <input type="text" id="class" name="predict_class" value=1>
             <label for="name">Age: 0 - 100 </label>
             <input type="text" id="age" name="predict_age" value=25>
             <label for="name"># Siblings and Spouses</label>
             <input type="text" id="sibsp" name="predict_sibsp" value=1>
             <label for="name"># Children and Parents</label>
             <input type="text" id="parch" name="predict_parch" value=0>
             <label for="name">Ticket Fare: 0 - 500 ($) </label>
             <input type="text" id="fare" name="predict_fare" value=250>
             <label for="name">Gender: M or F</label>
             <input type="text" id="sex" name="predict_sex" value='F'>
     <button class="btn" type="submit" form="titanic_predict" value="Submit">Predict</button>

    When you go check out your page you should see the web form there for you. Press the predict button though and you’ll get an error saying that method isn’t allowed. Flask routes by default enable the ‘GET’ method but if we want to allow any additional functionality, such as submitting data to the flask server via a webform we’ll need to enable those explicitly.

  2. Update the methods parameter to allow both ‘GET’ and ‘POST’ methods on the /titanic route.

     @app.route('/titanic', methods=['GET','POST'])
     def titanic():
         return render_template('titanic.html')
  3. Request the data from the web form inside the flask function.

     def titanic():
         data = {} 
         if request.form:
             # get the form data
             form_data = request.form
             data['form'] = form_data
             predict_class = float(form_data['predict_class'])
             predict_age = float(form_data['predict_age'])
             predict_sibsp = float(form_data['predict_sibsp'])
             predict_parch = float(form_data['predict_parch'])
             predict_fare = float(form_data['predict_fare'])
             predict_sex = form_data['predict_sex']
         return render_template('titanic.html')
  4. Test the connection from the web page to the flask function using the predict button to make sure data is being passed from the web form by printing it to the terminal. We will be feeding this data into our model to make our predictions.

Prepare input data and get the prediction

11a. Convert the predict_sex variable from a string into binary (F = 0, M = 1).

11b. Build the numpy array of values input_data to pass into the model. The order DOES matter.

11c. Call the predict_proba() method on the logistic regression model with our input data.

11d. Grab the survival probability from the prediction and put it into the data dictionary to be passed back to the web page.

def titanic():
    data = {} 
    if request.form:
        # get the form data
        form_data = request.form
        data['form'] = form_data
        predict_class = float(form_data['predict_class'])
        predict_age = float(form_data['predict_age'])
        predict_sibsp = float(form_data['predict_sibsp'])
        predict_parch = float(form_data['predict_parch'])
        predict_fare = float(form_data['predict_fare'])
        predict_sex = form_data['predict_sex']
        # convert the sex from text to binary
        if predict_sex == 'M':
            sex = 0
            sex = 1
        input_data = np.array([predict_class, 
        # get prediction
        prediction = L1_logistic.predict_proba(input_data.reshape(1, -1))
        prediction = prediction[0][1] # probability of survival
        data['prediction'] = '{:.1f}% Chance of Survival'.format(prediction * 100)
    return render_template('titanic.html', data=data)

Jinja Templating

We are now getting the input data from the form and predicting with it. Now we have to tell the client-side how to display the information. We will be using Jinja templating to control how data from the server is displayed.

  1. Add the following to titanic.html. In Jinja, we access data objects inside double brackets, i.e. ``.

    <div class="col-lg-6">
        <!-- Result presentation goes here -->

Take a look at the /titanic page and you can see that all the bits and pieces are hooked up. Time to do just a bit of UI work. Jinja allows you to use python-like logic to control the HTML that is displayed.

  1. In the titanic.html file, use a simple if statement to prevent displaying anything if a prediction is not present. Then add some HTML to structure what the user will see. Here we want to show the prediction and the input parameters they put into the model.

     <div class="col-lg-6">
        <!-- Result presentation goes here -->

That’s It! (we hope)

Fully Hooked Up Titanic Survival Model

At this point you should hopefully have a fully function flask-based web app that trains a model off real data and presents a simple interface to a user to allow them to make a prediction with the model and see the results.

More Resources

Week 6 / 7: Unsupervised Methods, Recommenders and Break Week

K-Means Clustering Animation

Unsupervised Methods

Well, it’s the end of break week, that’s why there wasn’t a post last Sunday. In the beginning of Week 6, we studied what are known as “unsupervised methods”. These methods involve using a computer to discover patterns in data and are often using in clustering or classifying applications. An example of a specific algorithm named “K-means Clustering” is shown above.

The way K-Means works is you take some set of data and tell the algorithm how many clusters (K) you think might be present. This can be done systematically or explicitly. The computer will then randomly place those K-cluster centers in the data and iteratively try to optimize the classification of the real data until you have the best optimized clusters possible. Optimization, in this case, refers to minimizing the euclidean distance between classified data points and their respective cluster centers as best as possible. Below, I’ve shown the results of K-Means clustering on the famous “Iris” data using K-values from 1 - 4. By eye, we can see that there is most probably 2 or 3 clusters present (humans are very good at pattern recognition) but we can tell the computer any number of clusters we want until the number of clusters is equal to the number of data points, at which point you will have classified each datapoint as it’s own class which is fairly useless.

K = 1 Clusters


K = 2 Clusters


K = 3 Clusters


K = 4 Clusters


This was a pretty fun little exercise, and I enjoyed building the different visualizations using both python’s matplotlib and an fantastic command-line tool called ImageMagick (thank you Denis) to make the animations. I’ve made the class file and documentation for my code available on github if anyone is interested. 

Matrices and Recommendation Systems

Apart from unsupervised methods, we again went back to linear algebra to learn a number of matrix factorization and dimensionality reduction techniques. The gist of these methods is that we can use matrix math to discover latent features in data, or to fill in unknown values with good estimates. Ever wonder how Netflix or Spotify recommends items to you? Matrix factorization is what it boils down to. Here’s an great and very accessible article on the topic from the Atlantic: How Netflix Reverse Engineered Hollywood.

Case Study: For this week’s case study, we built a joke recommender using the Jester Dataset. This is a dataset of 150 jokes with about 1.7 million ratings from 60,000 users. Our task was to best estimate the jokes that new users would score highly. My team used a GridSearch to cycle through a number of different parameters to best optimize our recommender system.

Next Week: Big Data Tools