Automatic Attach/Create With tmux

I’ve read a few posts about tmux and am considering switching to it over screen. The most recent one was Faster TDD feedback with tmux, tslime.vim, and turbux.vim by Joshua Davey. I don’t use Ruby much but the post definitely gave me a lot of cool ideas so my interest in tmux has been reinvigorated. I’ll probably spend some time this weekend tweaking my .tmux.conf and getting comfortable in it.

One “feature” I really wanted was to not have to think about whether tmux has a session open or not. I get this behavior automatically with byobu (Ubuntu’s screen profile + UI) and if you use vanilla screen you can just use the -R option. As far as I can tell this is not possible in tmux so I wrote this bash function:

function tmux {
    if (( $# )); then
        command tmux $*
    else
        if (( $(tmux list-sessions 2> /dev/null | wc -l) )); then
            command tmux attach
        else
            command tmux
        fi
    fi
}

If you execute tmux with no arguments then it will attach to your existing session or create one if needed but if you pass any arguments then they just get passed along to tmux as normal.

Also on GitHub, .bashrc.d/tmux.sh.

One issue I have found so far is that it doesn’t work if I `ssh somebox tmux. I suspect it’s because Bash is evaluating the function on my box not on somebox so I’ll probably end up turning this into a script instead of a Bash function.

Updated git-todo, No More Empty TODOs

After using my git-todo a bit I quickly became annoyed by empty TODO files so I added a check to remove the file if it is empty after leaving vim.

function git-todo {
    OS=$(uname -s)
    local SED_OPT
    if [ "$OS" == "Darwin" ]; then
        SED_OPT="-E"
    fi
    if [ "$OS" == "Linux" ]; then
        SED_OPT="-r"
    fi
    local GIT_DIR=$(git rev-parse --git-dir)
    if ! (( $? )); then
        GIT_DIR=$(echo "$GIT_DIR" | sed $SED_OPT 's/\/?\.git$//')
        if [ -z "$GIT_DIR" ]; then
            GIT_DIR=.
        fi
        local TODO="$GIT_DIR/TODO.taskpaper"
        vim "$TODO"
        if [ ! -s "$TODO" ]; then
            rm -f "$TODO"
        fi
    fi
}

Also on GitHub, .bashrc.d/git.sh.

10 9 Reasons the U.S. Is No Longer the Land of the Free

I’ve had 10 Reasons the U.S. Is No Longer the Land of the Free in my reading list for a few days now and today finally got a chance to read it. While it was sobering-bordering-on-depressing it was awesome that just moments before I read this I read Supreme Court Court Rejects Willy-Nilly GPS Tracking. So I am happy to know we can (sort of) cross off one of the items on the list!

Continual Monitoring of Citizens

Reading Web Articles On Kindle

While it may seem like an awesome idea to send every article you want to read to your Kindle I would recommend against it. Each article you send shows up as a separate document in Kindle’s Personal Document storage. And every one of these will show up in your Archive even if you have removed them from your device. In order to remove them from your Archive you have to go Amazon.com (Your Account > Manage Your Kindle > Personal Documents) and you have to delete them one-by-one with page refreshes after each. If you are quick you can squeeze in two deletions per page refresh.

Instead, if you want to read articles on your Kindle you should take advantage of a service that sends a compilation of articles as one document. I’ve tried Readability, Klip.me, and Instapaper. So far, Instapaper has offered the best experience.

Instapaper: Rocks but (Sort Of) Lacks Micropayments to Authors

I started using Instapaper on my iPhone a long time ago. It completely changed how I read. Later I got an iPad thinking it would offer a better reading experience than the iPhone. In some ways it was better but in many ways it was worse. Then I bought a Kindle. Instapaper + Kindle is amazing for text. I still use the Instapaper app on my iPhone and iPad but my first choice for text content is my Kindle.

Instapaper has had to reverse engineer the Kindle periodical format but they have done a stellar job. It is easy to navigate between articles and it is easy to see how far along you are in the article you are reading. You can request a new copy of your periodical from within the periodical itself. You can Archive, Like, and Like & Archive (but not delete) your article from within each article. It really is an enjoyable reading experience.

I’ve had a few issues with the Instapaper web app but they were always brief and more importantly not very common.

Klip.me: Failed to Entice

I did not use Klip.me for very long so it may be worth exploring further. It has an interesting feature in that it will allow you to edit the article but I don’t know if this works with their compilation or only when sending immediately.

It also appears to have a feature that some may find useful. It looks like it can send a compilation of all your Google Reader articles as well. I tend to scan headlines in Google Reader and then select the most interesting ones to read in Instapaper so this doesn’t work for my workflow.

Readability: Flawed But Noble

I really hate ads. Specifically I hate irrelevant, ugly, noisy, obnoxious ads. If your site has anything that remotely distracts me from actually reading the article then I will either not read the article or I will read it in Instapaper or Safari’s Reader. Readability stepped in here to offer an alternative to ads by orchestrating micro-payments to authors. I think this is an awesome idea and I hope some day it replaces the need of many authors to submit to obnoxious advertising.

Unfortunately, I found the web app to border on being unusable due to the following issues:

  • Actions (delete/archive) seem to be frequently undone or forgotten.
  • Poor title detection which resulted in useless titles such as the domain name of the site the article was from.
  • Duplicate documents received by my Kindle which have to be removed from my device and from Amazon.com.

I am not sure Readability deserves 30% of subscription fees simply for being a middle man. In the past I justified their cut by saying I was paying 30% for the reading experience, the ability to share articles, etc. but they now offer everything but the author contributions for free. So now if I am a subscriber I am not only giving a middle man a 30% cut of money I think authors should get but I am also subsidizing any freeloaders who use the service without contributing.

I subscribed to Readability for several months but have now reluctantly turned it off. Technically I could let Instapaper sync my articles over to Readability; giving me the better user experience from Instapaper while still rewarding the authors I read via Readability. However, at this time I am not comfortable with the 30% cut and, perhaps, more importantly there is no way for me to tell that the authors I like are even receiving their funds or that my contribtuions are even significant.

It’s Not Bribery If…

Chris Dodd, the chief lobbyist for the MPAA:

Those who count on quote ‘Hollywood’ for support need to understand that this industry is watching very carefully who’s going to stand up for them when their job is at stake. Don’t ask me to write a check for you when you think your job is at risk and then don’t pay any attention to me when my job is at stake,

Shouldn’t be a surprise to anyone really. We know congress has been corrupted by money. There are organizations, such as Rootstrikers trying to rally others to fight this.

A petition on whitehouse.gov has been started to “demand justice”. I don’t know if what Dodd is admitting constitutes bribery but it is up to the other branches of government to help keep the legislative branch in check. If that takes investigating bribery accusations then I think that should happen.

Laws that affect all should not be established in such a biased manner.

Git Todo

After reading Brett Terpstra’s na: Per-Project Todos in Terminal I decide to implement something similar but for my git repos and much more minimal. So I added a quick Bash function to always open TODO.taskpaper in vim (at the base of my git repo). This way I don’t have to worry about how many ../ to include, etc. Just git-todo and done. If you use TaskPaper and vim then get taskpaper.vim

function git-todo {
    OS=$(uname -s)
    if [ "$OS" == "Darwin" ]; then
        SED_OPT="-E"
    fi
    if [ "$OS" == "Linux" ]; then
        SED_OPT="-r"
    fi
    GIT_DIR=$(git rev-parse --git-dir)
    if ! (( $? )); then
        GIT_DIR=$(echo "$GIT_DIR" | sed $SED_OPT 's/\/?\.git$//')
        if [ -z "$GIT_DIR" ]; then
            GIT_DIR=.
        fi
        vim $GIT_DIR/TODO.taskpaper
    fi
}

Also on GitHub, .bashrc.d/git.sh.

Even a Giant Can Learn to Run

Link

In Even a Giant Can Learn to Run Mr. Palmisano says his four guiding questions for IBM have been:

  • Why would someone spend their money with you — so what is unique about you?
  • Why would somebody work for you?
  • Why would society allow you to operate in their defined geography — their country?
  • And why would somebody invest their money with you?

Somewhat related is this tribute IBM produced for its 100th Anniversary is worth watching: IBM Centennial Film: 100 X 100 – A Century of Achievements That Have Changed the World.

Acceptable Ads

I stopped using AdBlock a couple of years ago because I was concerned that if too many people used it then the some of the sites I liked would not be able to continue operating. Instead I started relying on Flashblock which would effectively block the worst ads but allow many through. So it is interesting to see now that AdBlock Plus has recently decided to start allowing some “acceptable ads” by default. The story is mainstream enough story that it made it onto The New York Times.

AdBlock Plus’s definition of acceptable is:

  • Static advertisements only (no animations, sounds or similar)
  • Preferably text only, no attention-grabbing images
  • At most one script that will delay page load (in particular, only a single DNS request)
  • Do Not Track support

Perhaps in defining “acceptable ads” we should also include a reasonable proportion of ad space/time to content space/time. For example, no 30 second pre-rolls on 30 second clips. No plastering the page with ads; even if they are text only. The whole point of this is two-fold to both maintain the value of your original content and of your advertisements. Quality over quantity because noise is ignored.

As a user if you do use AdBlock or similar you should also consider using Readability or Flattr. If you care about the content please don’t make it harder for the content’s creator to dedicate time doing it. (I prefer Readability for several reasons but I’ll save that for later.)