Train

(NOTE: These are my thoughts and opinions on working out and diets. There’s no science backing this. This is what works for me. Your mileage may vary)

A few weeks ago I realized that I had two fitness-related events, SF Spartan Sprint and Bay to Breakers, coming up soon that I needed to start training for. The fact that these events are back to back will make for a painful weekend in May.

While I’ve been going to the gym regularly for the past 2-3 years I felt that I had to make some changes to my workout routines in order to do well at both these events. Similarly, my diet would also require some tweaking.


My workouts have typically been very lifting heavy (pun intended), with cardio being almost non-existent most of the time. Since both these events are cardio heavy I needed to change that. At the same time I couldn’t eliminate strength training completely because the Spartan Sprint does have a strength component.

The fix was easy — do more cardio!

I’ve started running 4-5 days a week after my strength training. I’m currently doing 4 miles a day (9-10 minutes per mile), and aim to be able to run 8 miles before Bay to Breakers. Since I have a finite amount of time I can spend at the gym I can see myself having less and less time to work on strength training. And I’m OK with that — as long as I do the minimal amount of strength training to maintain whatever muscle and definition I have I’m happy.

I’m not a huge fan of running long distances (I once said “Cardio is my arch nemesis”) and get bored while running. In the past I’ve listened to music but for the longer distances (3+ miles) I’ve found that watching videos makes the time fly by faster. So far I’ve seen Scala/Odyssey, Groundhog Day, and a few episodes of Cosmos: A Spacetime Odyssey. I plan on watching some TED Talks next.

I’ve also changed my strength training a bit. I’ve reduced the weight I use for squats (310 lb to 270 lb) so that my legs are not extremely sore and I can still run. I’ve also started doing more weighted push ups (currently 50 with no weights and 50 with +20 lb) and pull ups (currently 25 with no weights and then 20 with +20, +40, +50, +60 lb)

Lastly, I’ve also started doing more abs and core workouts because it’s not something that I really focused on in the past. I currently do 50 crunches and 50 leg raises post running and stretching.


In an effort to shed some weight (180+ lb in 2013 to 155 lb today) I had became extremely strict about my diet. I greatly reduced my consumption of fried food and desserts, and completely eliminated soda from my diet. I tried to keep my meals as simple as possible and stayed away from rich, heavy food items during the week. During the weekend / if I went out I was less strict on myself.

All this seems quite reasonable.

But I also did something that hurt me when I started doing more cardio workouts — I reduced my consumption of carbs (rice, pasta, bread, etc.). Most of my meals in the past used to be very protein heavy, with little to no carbs on my plate. As you know, carbohydrates are a source of energy. While the lack of carbs in my diet didn’t really affect me when I was lifting, it definitely did when I started running 3+ miles everyday.

I felt weak. I felt tired. I felt foolish for not eating carbs.

So I changed that. My plate was reintroduced to brown rice, quinoa, and (occasionally) waffles. The results have been excellent — I no longer feel completely drained of energy post working out. And my weight has stayed pretty constant too, with only the usual plus/minus 2 lb fluctuations.


Overall I think this is the best I’ve every felt in my life — physically, mentally, and even emotionally.

 

TOAST

The other day I was working through my (quite massive) backlog of saved Hacker News stories and read this gem — Introduction to PostgreSQL physical storage. As someone who has loved databases forever, and has spent over a year building LinkedIn’s next generation distributed graph database, I found this post absolutely fascinating.

As the title suggests this article talks about how data in PostgreSQL tables and databases are actually stored on disk and how free space (to figure out where to store incoming data) is managed. The diagram of the page structure is very helpful in understanding how data is stored in a page. I also really liked the use of PostgreSQL queries used throughout the article to explain the topic at hand by examining a real PostgreSQL instance. The author does a great job at explaining concepts at just the right amount of detail, with several links provided for those interesting in learning more.

(Relevant side bar: the PostgreSQL source code documentation is amazing)

Cache

One long standing issue that I’ve had with the LinkedIn GitHub page that I helped design was that it because it relied on the GitHub public API to fetch all the data, if the user accessed the page from a rate-limited IP address the rendered page would be blank as no data would be returned by the API. I had some time on my hands today and decided to fix this bug.

The simplest fix for this bug is to cache the GiHub API response in a file, and when you get rate-limited by the GitHub API fall back to reading from a cached API response. Since the raw API response contained lots of information that was not required to generate the website, I decided to add an intermediate filtering step to only extract the relevant information from the raw GitHub API response. The JSON data generated by this filtering step is the final cache used by the webpage.

To test the code I’d written and to make sure everything works as expected I needed to rate limit myself. This was easily done using the (amazing) Python Requests library.

You can find my fix for this bug here.

Update — I realized that my original patch failed to use the GitHub API response when the user was not rate limited. My last commit should fix this.

 

Vocal

Here is a list, in no particular order, of some of my favorite vocalists in metal music:

  • James Hetfield (Metallica): Metallica were one of the first metal bands that I listened to and to this day I associate James Hetfield’s powerful voice with metal music.
  • Rob Halford (Judas Priest): I’m amazed by the high notes he can hit.
  • Bruce Dickinson (Iron Maiden): His vocal range is incredible.
  • Maynard James Keenan (Tool, A Perfect Circle): His voice has a sadness and raw energy to it that I think is simply wonderful.

  • Daniel Tompkins (TesseracT, ex-Skyharbor): Favorite modern metal singer. His cleans, his screaming — all incredible.
  • Chino Moreno (Deftones):  His voice has an ethereal, dream-like quality that is beautiful.
  • Mikael Åkerfeldt (Opeth): 2nd favorite modern metal singer.

  • George Clarke (Deafheaven): His screams are pure, raw energy. Favorite screaming vocals.
  • Ian Kenny (Karnivool): Another singer with an incredible vocal range.

 

Analyze

Inspired by Spotify’s year in music feature (I wrote a post on it as well), I decided to analyze music related data that I had at my disposal. The data that I chose was the list of all the artists that I’ve seen live (78 at the time of doing this analysis).

There were two things that I wanted to surface from this data:

  1. Which genres of music have I seen the most live?
  2. Which artists should I see next, based on the artists I’ve already seen?

To answer both these questions I decided to use the Echo Nest API. And Python. All the code I wrote to analyze the data can be found here. I wrote this code when I should have been sleeping so the quality is not the best. Oh well.

About halfway through writing the code I decided that generating a word cloud for #1 would be cooler than simply listing the top genres. After failing miserably to get word_cloud working on my machine I decided to use an online word cloud generator instead. Here’s the resulting word cloud:

Screen Shot 2016-02-23 at 6.58.51 PM

The technique I used to answer #2 was to get the list of similar artists for each artist I’ve seen live, remove artists that I’ve already seen, and keep track of how many times each unseen artist is listed as a similar artist. Here are the top recommendations generated by my algorithm (format: <artist, number of times listed as similar artist>):

  1. Swedish House Mafia, 5
  2. The Raconteurs, 4
  3. Cut Copy, 3
  4. Beach Fossils, 3
  5. Kaiser Chiefs, 3
  6. Iron Maiden, 3
  7. Dio, 3
  8. Ellie Goulding, 2
  9. Black Sabbath, 2 (seeing them in September)
  10. Animals as Leaders, 2

My recommendation algorithm is extremely simple but produced surprisingly good results.

The Echo Nest API is incredible.

P.S. I tried using pyechonest but there didn’t seem to be a way to retrieve artist genre information which is why I decided to use their API directly. 

Listen

Spotify’s year in music feature is brilliant. They took something simple, namely the play count for an artist/song/genre, and interpreted it through different time filters to create a a very fun product. I’m a fan of the design of that page, especially the colors.

Here are some of my statistics from 2015:

Spotify_yim_en-US_Q_xLs6.jpg
I thought this number would be higher.
Spotify_yim_en-US_lJ1ql2
No surprises here. I’ve seen 4/5 of these bands live!
Spotify_yim_en-US_qRkpVp
Again, not surprising given my top artists.
Spotify_yim_en-US_T7Zcp9
I LOVE this song. I still listen to it at least once a day. I even wrote a blog post about it.

Quality

I loved Fred’s post on the Zen of Erlang. I decided to check out his blog on the bus ride back from work today and read a few of his other posts. Two posts stood out to me.

Lessons Learned while Working on Large-Scale Server Software is, in my mind, required reading for any software engineer working on backend and infrastructure systems. Knowledge of lot of the concepts mentioned in this post (like the CAP Theorem, or the Fallacies of distributed computingis essential in developing robust software systems. Fred’s style of writing is lots of fun to read, and I really his views on computer networks in this post —

There’s nothing more dangerous than someone going for a stroll over the network without knowing what it entails.

The network owes you nothing, and it doesn’t care about your feelings. It doesn’t deserve your trust.

The network is a necessary evil, not a place to expand to for fun.

The second post that stood out to me on how Queues Don’t Fix Overload. He explains in simple terms why queues (when used incorrectly) seem to solve your scaling problems in the short run while introducing a whole new class of problems of their own. As mentioned in the post, identifying bottlenecks in your system and scaling and fixing those is the correct way to deal with system overload.