Python script to check HTTP status and redirect chains

Here’s a quick and dirty Python script that goes through a list of URLs, and for each URL checks HTTP status codes (200, 301, 404, etc.), along with number of redirects and redirect chains (each redirect destination).  Saves output into a text file (you can modify to save to CSV, but I used text import feature in Excel to import tab-delimited data).

Well, damn hosted WordPress doesn’t let me paste code correctly, so here’s the link to Gist.

Update: and here’s how to post Gist properly:

Screen Shot 2015-10-01 at 10.59.23 AM

Setting up WordPress behind a reverse proxy

Task: put a WordPress blog/site behind a reverse proxy. So moves to

Why? In our case, we do it for branding and also for SEO benefits: larger site receives more traffic, and we want to fold our blog content into

Let’s agree on a couple of terms before we start:
– original is A
– destination is B

I’m using the latest version of WordPress (4.2.2) and Apache (2.2) on Ubuntu.

Let’s get started!

  1. Server setup

  2. Before we even touch WordPress, we need to make sure that the server hosting B is ready to accept requests and forward requests for any URL to A.

    Assuming we have Apache setup and working, let’s make sure mod_proxy is enabled. With root or sudo privileges, run:

    a2enmod proxy_http
    service apache2 restart

    Then, open the Apache virtual hosts config file, and add:

    ProxyPreserveHost On
    ProxyRequests Off   
    <Location /blog>
        Order allow,deny   
         Allow from all

    Quick explanation for each line:

    ProxyPreserveHost On: Off by default. I’m turning it On because I host multiple sites on this server and use virtual hosts. If you don’t need it, simply exclude this line

    ProxyRequests Off: should only be on for forward proxy, not for reverse proxies

    <Location /blog>: applies proxy directives to requests matching /blog

    ProxyPass creates a mapping from a path within the local web site to a given remote URL

    ProxyPassReverse rewrites URLs in HTTP headers
    Order allow,deny: allows access to all proxied content

    After that, restart apache again:

    service apache2 restart

    Result: If you got this right, when you load you should see your WordPress blog home page.

    Note: if you see errors 500 on interior pages, check .htaccess file for any rewrite rules, and adjust if necessary.

    If you run into issues, here are 2 great sources on how to setup reverse proxy on Apache:

  3. Update WordPress settings

    Now we got to make sure that all URLs (category pages, single post pages) also display correctly on site B.

    For this, log into WordPress admin using the original login link:

    Go to Settings > General, and update the “Site address (URL)” field to B (

    Screen Shot 2015-07-13 at 2.52.32 PM

    Result: All pages should be accessible and rendering correctly.

  4. Update redirects, canonical tags, robots.txt

  5. This is a pretty extensive area that I have not completed yet, so I’ll add to this section soon once I have this task completed. Stay tuned!

  6. Fonts

  7. If you use any font embedding services, make sure you have correct license to match your new domain (, because it’s different than your original

  8. Administration

  9. You should be able to login and administer all content via the original link

Being a detective (work these days)

These days work is fun. I have a handful of project of various complexity, and the deeper I dig, the more related projects I discover.

Example: streamlining and organizing existing apps and setting up continuous integration that works for Python and potentially node in the future.

Python is great and all that. But I’m struggling with all the dependencies and pieces to be managed (module dependency, db, aws storage, cron, source control and remote server management). Using js-only stack with heroku and deployments triggered via git in the past was way quicker.

Currently reading:

Data science is the new cool thing to learn

I wrote about learning practical data science with Python, and nowadays everyone wants to learn and teach data science. From many online educational sites, to General Assembly and this organization called Metis, that provides extensive courses and assists with job search in that field.

I think Metis’ data science bootcamp sounds really cool, and a great career path for someone who is apt for statistics/analysis/programming and starting out (or switching to tech).

Too many tools spoil the web dev world


Well, not this kind of tools :)

Marco elaborates on why tools and frameworks for web development have become so complicated and convoluted (and usually unnecessary), in response to PPK’s post.

Web development has never been more complicated or convoluted than it is today due to the sheer quantity of tools (and their rapid rate of change) involved in most modern web-dev environments.

At the Generate conference, Brad Frost also half-jokingly noted that a web developer applying for a job these days must go through a ridiculous list of “frameworks” that he/she must know.

“Our job descriptions contain so many acronyms… How do we keep from drowning in a sea of devices, tools, technologies, Medium posts, tweets, and opinions? And how do we maintain our sanity in the process?”

My short take of this: know why tools exist and what problem they solve, at what cost. Like with anything in this life, you can’t have it all. Frameworks might help (or often appear to help) with speed and cost, but you might lose on quality of the end product, since it is not going to be perfectly custom to your needs.

PPK proposes a solution:

The solution is simple: ditch the tools. All of them. (No, I’m not being particularly subtle here.) Teach the newbies proper web development. That’s it, really.

The web’s answer to the native challenge should be radical simplification, not even more tools.

Would you agree?

jQuery CSV parser shows CSVDataError: Illegal state

Just a quick troubleshooting tip. If you are trying to use the jQuery CSV data parser on Mac, it might give you this error:

CSVDataError: Illegal state [Row:1]

The reason is likely your CSV file that was saved on a Mac. Apparently, line endings on Macs use special characters, and the parser “chokes” on them and spits out this error.

To get around this, clean the input by adding this line of code:

// Normalize new lines
result = result.replace(/[r|rn]/g, "n");

This worked for me, hope you find this helpful! (via this link)

Notes from the Generate Conference 2015 in NYC

It was an amazing Friday last week, at the Generate Conference in NYC.

Here’s a brief recap of topics covered (from my point of view).

Best talks
– Expertise category: Lara Hogan on performance
– Case study category: Jon Setzen on 24-hour experience
– Entertaining category: Dave Rupert on prototyping and play
– Energizing and ass-kicking category: Mike Monteiro on 13 designers’ mistakes

Notable trends
– performance is being taken seriously now. Everyone recommended, and working across teams to educate them on importance of performance optimization, and establishing “performance budget” for your projects
– rapid prototyping helps win business
– it’s a designer’s job to lead a presentation and “sell” the design to clients. “A good designer who can sell work is more valuable than a great designer who can’t.”

Random notes
– Brad Frost cracking up the entire time during Dave Rupert’s presentation. Crowd-energizing talk by Mike Monteiro. It is pure joy to watch someone who’s not only an expert, but also funny and/or brutally honest
– Shopify workshop was informative and inspiring. I built a Shopify store 3 years ago, and it was a great experience. Good opportunity for developers to make money by being experts/affiliates on their platform
– Good format, venue and programming. One day, 2 tracks, great speakers, AND reasonable pricing
– Got Mike’s book and Shopify’s Grow guide. Happy.

Instagram is happy, Twitter is whiny

Agree with Jason Fried’s take on these two platforms.

When I have a few minutes to kill, and my phone is in front of me, I almost always reach for Instagram. I never regret it. I come away feeling the same or better. When I occasionally reach for Twitter, I discover someone’s pissed about something. I often come away feeling worse, feeling anxious, or just generally not feeling great about the world. Twitter actually gives me a negative impression of my friends. I know it’s not Twitter doing it, but it’s happening on Twitter. that’s how Twitter feels to me.

For similar reasons, I don’t use Facebook and almost never check Twitter. I’m not that cool to be on Snapchat or Periscope. But I’m on Instagram all the time. And best way to get in touch is via good old fashioned email: