Solving the twitter monetization problem



I think I have a solution to the twitter problem. Clearly, I do not mean that my simple suggestion will solve all of twitter problem, but I think it will provide a stream of income.

Twitter currently is struggling to grow its daily active user base. On top of that, it is simply struggling to increase its profits.

I have an idea for the latter. Instead of having promoted tweets, have a promoted brand on an organic tweet. For example, say I want to promote my brand on twitter. Instead of having my tweets show on users timeline that does not follow my account, has my handle/slogan/name appear on the frame of a handle’s tweet of my choice. Say know a large portion of my audience like President Obama, then I could pay twitter to have my brand shown with Obama’s tweets. Just like major sports events where everything is branded (down to the ladders in March Madness!)

Next time Obama tweets, it would look something like this:

It was a pleasure to meet with @Putin. Our relationship with Russian has never been better.
*This tweet is brought to you by*



My Development Environment Setup



By far, my favorite tool in my dev setup. Sometimes the only thing that drives me out of bed is trying out a new trick in vim. It drives me to be to be a minimalist developer by minimizing keystrokes when editing code. It encourages me to be more efficient. And it reminds me that development could be elegant. My vim configuration can be found at MyVimRC. Here are some of my favorite vim configurations with their explanation:

  • set cpoptions=ces$. This makes the commands like cw put a $ at the end of the w motion as a guide on where the change command will take effect.
  • autocmd BufWritePre * :%s/\s\+$//e. Get rid of accidental trailing whitespace on save.
  • set incsearch. Incremental search while typing your search term. Simple, but it deserves a spot on my list of favorite configurations.


It is embarrassing how I use tmux in my development flow. Currently, I only use it to start my development terminal (splitting pane between vim, and two bash terminals). Plus some cool trick that I blogged about earlier here. Here is how tmux looks when I launch it:


Finally, for bash, I use it mainly for aliasing frequently used commands. I would love to have more scheduled tasks using cron in the future, but for now, I don’t have much. Here are my favorite aliases:

  • alias pjson='ruby -rjson -ne "next if \$_ =~ /^\s*$/; puts JSON.pretty_generate(JSON.parse(\$_))"'. Pretty prints JSON objects.
  • alias add="ruby -e 'puts STDIN.inject(0) {|sum, li| sum += li.to_f}'". Adds a stream of numbers from STDIN. For example, if you want to know the total number of bytes in a directory, you would have something like this
    ls -al /path/to/directory | awk '{print $5}' | add.
  • alias avg="ruby -e 'n = 0; sum = STDIN.inject(0) {|sum, li| n += 1; sum += li.to_f}; puts %Q{#{sum} / #{n} = #{sum/n}}'". Similar to add but it is average instead of sum.

**For bash commands, credits goes to my mentor at ListenFirst Ben Kao.

Lastly, here is my music recommendation by the Indian jam project that goes well with this post. Go and give them some love.


The Importance of Research


Why do humans conduct research?

This question comes in my different forms. A related form that is asked more often is: How does [insert project name here] is useful for us? When I was a researcher in physics, I get asked by my friends and family about what I do. And it always leads to the same question, how is that useful? I have seen my peers approach this question with what I could sum up to the following:

  • It is just curiosity research.
  • We have not found a use outside of academia yet.
  • It is useful because it will allow us to [insert futuristic/non-scientific bullshit here].
  • Most of the technology you see right now started with research. Research that was thought to lead nowhere.

I like most of the answers above. However, some people are left unsatisfied, and they should be. We need to educate people that without research, we are not human. Instead of giving these doubters an answer on why your research problem is interesting, let them question the reason humans conduct research. You can do that by giving them an example of a kid that grows up not asking any curiosity-based questions. A kid that only does what she is told to do. How do you think that kid will end up? Imagine another kid that is always asking questions. Just plain questions about everyday things (like why is the sky blue or why do stuff fall to the ground).

Now compare the two kids after they become adults, who do you think will be conducting research? who will be questioning the fruitfulness of research? I will let you answer that question.

In the end, I will leave you with a pretty assertive statement on my end. ASKING QUESTIONS IS THE ONLY WAY TO LEARN.

Disclaimer: I do realize that asking how useful a research project is a ‘question’ in itself. I am only addressing people who are asking the question sarcastically!

Always be asking.

Tmux Kung fu


This post is inspired by the beautiful unix command $ fortune

for extra fun, $ fortune | cowsay

/ You can not get anything worthwhile   \
| done without raising a sweat.         |
|                                       |
| -- The First Law Of Thermodynamics    |
|                                       |
| What ever you want is going to cost a |
| little more than it is worth.         |
|                                       |
| -- The Second Law Of Thermodynamics   |
|                                       |
| You can not win the game, and you are |
| not allowed to stop playing.          |
|                                       |
\ -- The Third Law Of Thermodynamics    /
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

Earlier this month, I discovered this awesome website called ComandLineFu. The idea of this website is to provide unix gurus (and n00bs) a way to learn unix tricks from masters. It has a voting mechanism so that good unix trick will surface up the rankings and land on the front pages.

Anyways, they have an API. So I thought, why can’t I have a way of showing random unix tricks from commandlinefu in a way that is similar to $ fortune ?

First, I wanted a few requirements. Here is what I wanted:

  • Show tips randomly
  • Show brief explanation for each tip.
  • Update tips every x seconds

The first two requirements can be fulfilled by the API. As for the last requirement, I will be using tmux status line and update that every x seconds.

Let us implement the first requirement. The way I did that was through $ curl and $ jq. Here is the code:

$ page=`shuf -i 0-1000 -n 1`; item=`shuf -i 0-24 -n 1`; curl -s "$page" | jq -r ".[$item] | [.command, .summary] | @tsv" | sed "s/$/ # /g"

Let us break it down real quick. First, we initialize page and item to random numbers (I picked these ranges because these are the items I am interested in). Then, we $ curl the API with the random page as the endpoint and pipe the result into $ jq. Then we grab the fields that we are interested in, namely, ‘command’ and ‘summary’ and do some formatting gymnastics. That is it. As simple as that.

Now that we have the $ fortune part of the pico-project, how do we go about $ cowsay? It is just a couple of lines in tmux.conf! Just add the following:

set -g status-interval 60
set -g status-justify centre # center align window list
set -g status-left-length 200
set -g status-right-length 140
set -g status-left '#[fg=green]#H #[fg=black]•  #[fg=green,bright]#(page=`shuf -i 0-1000 -n 1`; item=`shuf -i 0-24 -n 1`; curl -s "    s/browse/sort-by-votes/json/$page" | jq -r ".[$item] | [.command, .summary] | @tsv" | sed "s/  / # /g")#[default]'

And you are done. Now you have a tmux session that will show you random unix tips every 60 seconds. Cool right?