Swapping Buffers in Emacs

It took me awhile to find a way to swap the position of two buffers in emacs. Yes, there is a description in emacs wiki, and the code bellow is actually taken from there, but it’s not that easy to find through the tons of irrelevant information arround it.

So if you’re looking to simply get the right buffer show on the right, and vice versa, here’s what you should add to your init file:

(defun transpose-buffers (arg)
      "Transpose the buffers shown in two windows."
      (interactive "p")
      (let ((selector (if (>= arg 0) 'next-window 'previous-window)))

          (let ((this-win (window-buffer))
                (next-win (window-buffer (funcall selector))))
            (set-window-buffer (selected-window) next-win)
            (set-window-buffer (funcall selector) this-win)
            (select-window (funcall selector)))
          (setq arg (if (plusp arg) (1- arg) (1+ arg))))))

I have no idea what this code means1, but it does what I expected it to do. I also didn’t create a keybinding for it, but you can if you would like to. Here’s how to bind it to, say, f8:

(global-set-key [f8] 'transpose-buffers)



Learning elisp is on my todo list…

On KPIs and Building Blocks

Few days ago I presented our product vision and roadmap to our R&D group. At the end of my presentation I was asked what gives me confidence that we build the right stuff. I didn’t think too much, and answered that our vision and product roadmap define the what. Knowing our partners and users, I added, and listening to their feedback, problems, and goals help us plan the when. That’s a typical product guy’s answer, yet it’s not a satisfactory one.

Continue reading On KPIs and Building Blocks

Combine Multiple PDF Files Into One

I often have to send pdf documents via email. When I do, I prefer to send one document that merges all those pdfs. Form a recipient point-of-view, I find it better to receive one attachment, because it’s easier to manage and to keep track of. The problem is that I’ve yet to find an easy way to stitch together multiple pdf files. Preview supose to let you do it, but I usually can’t get it to work, and when I do, the process is painful1.

Recently, I came up with way to do just that, thanks to a python script I found in the “Automate the Boring Stuff with Python” book. This script takes a folder of documents as an input, search for all the pdf files in that folder, and combine them into one pdf file.

However, I had to modify this script to fit my workflow better. My pdf files are all over the place, and I don’t want to move them around just for the sake of merging them together. I therefore made a little tinkering to the original script, so it can take a list of files’ paths as an input. Here’s my modified version:

#! /usr/local/bin/python3
# combinePdfsFromFiles.py - 
# Script gets a list of pdf files' paths and combine them into one file
# I use it together with keyboard maestro

import PyPDF2
import os
import sys
import logging
import pyperclip

pdfFiles = []

# Get PDF filenames from the clipboard
for filename in pyperclip.paste().split(','):
    if filename.endswith('.pdf') and filename != '':


pdfWriter = PyPDF2.PdfFileWriter()

#Loop through all the PDF files.
for filename in pdfFiles:
    pdfFileObj = open(filename, 'rb')
    pdfReader = PyPDF2.PdfFileReader(pdfFileObj)
    #Loop through all the pages (except the first) and add them.
    # If first page should be discarded, change firt param of range to 1
    for pageNum in range(0, pdfReader.numPages):
        pageObj = pdfReader.getPage(pageNum)

#TODO: add an argument that determine whether cover should be included.

#Save the resulting PDF to a file.
pdfOutput = open('/Users/ygilad/Desktop/allminutes.pdf', 'wb')

I created a simple keyboard maestro macro that goes along with this script and serves as an interface with it:

combine_pdfs_macro.jpg Now, All I have to do is select in Finder the files I want to stitch:

stich_pdf_-_select_files.png I can then execute the KM macro, which pass the list of files to the python script for processing.

I know this process might sound tedious, and even more painful than using Preview for that job. But that’s the beauty of automation – you pay once use freely ever after.



To get it done with Preview, you’ll have to open each of the pdfs, expose the thumbnails’ sidebar, and start dragging and dropping the pages you would like to combine. If you’re still interested, here’s Apple’s support guide.  ↩

On Collection and Vision

Marimekko is one of my favorite stores 1. Whenever I go in there, I get filled with excitement and urge to swallow the entire collection. I’m fascinated by the vibrant colors and the unique, yet simple, patterns. I’m compelled by the layout of the store and by the arrangement of the items. When I’m there, all I’m thinking about is how to make my home a replica of that store.


Figure 1: Marimekko on 5th Ave., NYC


Unfortunately, I can’t afford taking over Marimekko yet, and even if I could, I don’t know what would I do with hundreds of yards of beautiful fabric 2. And so I have to limit my focus to only one, maybe couple, of items at a time. But when doing so, much of the early excitement vanishes.

When looking at each of the items separately, they don’t look as compelling. A colorful serving plate loses its charm when I figure it won’t fit our current portfolio of dull white dinnerware. A Puisto-osasto print bag looks great, only until I see it’s a tote style bag, which I would never dare to carry. A sofa pillow with colorful flowers’ print, which is Marimekko’s signature, is stunning, yet won’t make it to our subtle, minimalist living room.

So beautiful as a whole, less so when zooming in. And so I usually leave the store empty handed (sometimes with yet another espresso cup).

I use this metaphor occasionally when talking about the difference between vision and the parts that make this vision a whole. I use it to explain to my team why is it that an inspiring vision turns into a list of less exciting projects: improving our api by exposing more resources’ types or adding attributes to existing ones, keeping high standards with our internal tools, even if they don’t add direct value to our users, or designing and developing pixel perfect internal reporting dashboards. These are efforts that don’t always make sense if you look at them in disjunction from the bigger picture, and see how they become part of a comprehensive product in aggregate.

At other times I use it to give some perspective to a feature owner who feels disappointed when the feature she just released didn’t take the Internet by storm. I explain that when building a platform, it’s unlikely that a single feature will “steal the show”.

A vision, like the Marimekko store, excites and inspires only when viewed in its entirety. When you dive into the details, the products and features that comprise it, you might loose your initial enthusiasm.

If you’re in a leadership position, remember that while you live and breathe vision, your team is soaking in the details, and in the day to day tedious work that is anything but exciting. Your challenge will be to inspire them, and keep them inhaling the dream. Otherwise, your team’s morale and its motivation to follow your lead towards fulfilling your vision will quickly evaporate. Thus, the collection you envision will turn into an incoherent pile of items that look bad anyway from near and far.



I’m referring to Marimekko NYC Flagship Store. Here’s where it located.


I do try to find uses for their fabric, often as a gift wrap for special people in my life.

Just Do It, But Start With a Small Step

If you’re reading this sentence, it means that I proved my point without even getting you through the rest of the

I’ve just got back from a run, which reminded me of a principle that is etched in my mind and serves as one of my mottoes in life.

I didn’t really want to go running today. I had an eventful weekend, which included many miles of walking. I was tired and hungry and had a presentation for a lecture I’m giving tomorrow to prepare. Many good reasons to call it a day and give up on this one run. After all I run 3-4 times a week; skipping one day won’t be the end of the world.

But then again, giving up on even one run is a slippery slope. You resonate it once, and soon you find even better explanations for why you shouldn’t run the next time, and the one after. Before you know it, you’re not running anymore. So no, I wasn’t willing to give up on this one.

To overcome my weariness I set myself with a humble goal – put running shoes on. I then pleaded myself to walk out the door and jog just for a little. Any distance, I promised myself, will do. Even a mile or two will be better than not running at all.

It worked. As soon as I took just a few steps the earlier fatigue evaporated, and I started to feel invigorated; a feeling that strengthen as I gulped more steps. After a mile or so I had no doubt I’ll run my regular 3 miles.

So far, nothing special. I’m used to that routine. Every time I have to do something that requires attention and focus, like replying to a long email, writing a new blog post, or do something that I’m not excited about, such as taking the dishes out of the dish washer, I have to deliberate and negotiate with that side of me that wants to rest and be left alone. The most effective weapon I use to avoid procrastination is taking the smallest possible step. Click the “reply” button, write the first line of the potential post, or open the dish washer door. Chances are this small step is enough to push me through the completion of the task.

But today’s run was special, in that it illustrated how powerful the “small step” principle is.

As I mentioned, few steps were enough to push me for to run my regular distance. But then, before reaching half way to that goal, I felt a surge of energy. I don’t know why it suddenly emerged, maybe a good idea that I came up with for my presentation, but it made me feel ambitious. I now wanted to hit the 5 miles’ mark. Remarkably, when I got to the 5 miles turning point, I wanted to go even further. I didn’t though, because I had to go back home, since dinner was on its way [1].

Nike’s slogan, “Just do it”, is inspiring. Yet it doesn’t solve for how you get yourself to “do it”. Taking a small, modest and non-committing step is the most effective way to get things done. But I’m not saying something new here. Much was already written about the power of a small step. Kaizen [2] is built around this concept. I’m just attesting that it really works.

Back to the first sentence of this post. I though about all of this during my run, and figured it might make an interesting post. But by the time I got home, had dinner and set to finish my presentation, I was too tired to start writing. I also wasn’t too encouraged to do it, given the finale of that run (more on it in a sec). I convinced myself, though, to write only one sentence, the one that opens this post.The power of small steps…

Now let me conclude with an anti-climax: this heroic run. I got to the 2.5 miles mark and turned back for the second half. But then, about a mile before the finish line, my legs failed me, and vetoed my aspirations. They forced me to stop at once, and did me a favor by carrying me that last mile, clumping and aching. This breakdown, which I never experienced before, left me confused: should I be happy for not giving up on this run, or disappointed for stopping before reaching my goal. I’m too tired though, so I’ll leave it for you to decide.

[1] By now I should have stakes in Seamless. Ordering every night for the last 2 years makes me an angle investors, at least…

[2] Kaizen is the practice of continuous improvement. Read more about it.

One Ineffective Review

Earlier today when I went to grab launch, I came across a lady who stood at the entrance to a fitness club trying to engage with passer byes. I think she was an ex-employee or a past customer of this club; either ways sensed she wasn’t very pleased with it. I probably got that impression because she kept chanting profanities, and urged people to avoid entering it.

Her scheme worked – no one seemed to enter the place.

Well, if you think about it, this scene took place on 14th street, which is swarmed with people, especially around lunch time. And so 99.99% of those people have no intention to get a workout. This lady was trying to convince the convinced. Or maybe she was hoping that her ferocious exhortation will keep them from even thinking about it in the future.

But for some reason this surreal sight of this poor lady, who I don’t think is crazy, but who was for some reason offended by something or someone in this place, so much that she took upon herself to review it physically and vocally to anyone she could have reached, got me thinking. It seemed to remind me of something else, but I’m not sure what.

When 2 Weeks Are Faster Than 2 Hours

Few weeks ago I bought my wife a set of lenses for her iPhone. Usually I buy everything on amazon, but this time I ordered from B&H, a brick and mortar retailer with an online store, because it sold what I wanted for 25% less.

When I received the item I found that I ordered the wrong model – one for the iPhone 4s instead of the 5s. I submitted a request for an exchange, which was approved. I wasn’t clear on how B&H’s exchange process works, so I called their customer care. The guy I spoke with, who was super nice, explained the process and said that it might take about two weeks to get a replacement. To avoid the long wait, he suggested I’ll swing by the store and make the exchange there. It will be faster, he said, and I agreed.

Today I went to the store. But when I got there I found that I’m not the only one thinking they can “game” the system. About 20 other customers had the same idea, creating an expected waiting time of about 2 hours. I loathe lines. Just the idea of waiting for an hour at the DMV gives me more agitations than that of going through a root canal procedure. So no way I’m going to wait 2 hours to replace merchandise.

And so I went back home with the wrong model. I plan to ship it back to B&H, and buy the correct one on Amazon. It will cost more, but at least I know I can’t go wrong.

This experience made me think about the concept of “speed” and about trust.

Is faster really faster?

The guy from B&H assumed I would prefer waiting 2 hours in store than couple of weeks for a delivery. He was thinking about speed in absolute terms – 2 hours vs. 2 weeks. I, on the other hand, think about speed differently. I take into account other variables, such as the actual – physical and mental – waiting time, and the total of the transaction.

Let’s think about actual waiting time first. At almost any given moment, I have Amazon packages en-route to me. I don’t really wait for or keep thinking about them. They create zero mental load on me. But when I’m standing in line, crammed between 20 other customers, lamenting the lose of a Friday, I feel the wait with every fiber in my body. For me, 2 hours of wait are like a pure torture. They feel worst, and hence longer, than a shipment that will land on my door eventually.

But even if you think about speed in absolute terms, in-store exchange isn’t much faster. I talked with the B&H representative more than a week ago. Since then I’ve tried to find time to visit the store (more mental effort). Turned out the only day I could made it was today, a vacation day. Overall then, I waited almost the same amount of time I would have, if I shipped the item.

And here’s where the second and more important insight. You might ask why did I go to the store and didn’t send the item back?

Trust is in the details

B&H has an amazing store. If you haven’t been there and you’re in NYC, you must pay it a visit. And if you have kids, take them with you. It’s like an amusement park for electronic devices, where gadgets take rides from the automated warehouse to the checkout. They’re doing it in electric plastic carts that run on rails across the entire ceiling of the store. The constant bustling and rattling sounds of the moving carts feels like there’s a roller coaster running over your head.

This design instills confidence. When I’m in this store, all I can think of is “boy, those guys know their craft and understand technology.” But then, when I tried to return an item online, this confidence vanished. I didn’t feel that I can send the item and forget about it, as is the case with Amazon.

Let me explain. When you decide to return an item to B&H, you have to fill-up a form online. You then submit it, and wait for a representative to reply. This simple flow creates immediate concerns. Waiting for a reply means that someone has to process my request. But will anyone pick it up? will they approve it? how long should I wait for a response?

Fortunately, my exchange was approved. I got an RMA form [1] the following day. It noted that I agreed to receive a replacement instead of a refund. This form, though, raised more concerns – how can I be sure someone will read this form, see that I asked for a replacement and ship back the correct item? I started to think about the workflow this form triggers, and became aware of all the possible points of failure in that process. In addition, the form indicates the address where the item should be returned to. That’s another point of failure, since I have to fill-out a return label, and hope the package will then ship to its destination.

Thinking about this process, I can see why the B&H representative suggested I will go to the store, and why I thought that’s the right thing to do. To make sure I return the product and get a replacement, I should go to the store in person.

Now, think about Amazon, where all of this complexity is hidden from the user. You want to return an item? no problem – here’s the label. Print and attach it to you’re item. Drop the item at the closest UPS store, and a refund will hit your account (minus delivery fee), or a replacement process will initiate as soon as you exist the door. The whole process is automated, done using printers, scanners and emails. No human intervention, hence no place for error. At least that’s how you feel. And just like a magic, few days later a new package delivery is waiting at your door.

And so, here are my take aways:

  1. As a customer – trust worth money.
  2. As someone who builds products – keep your users in Wonderland, and don’t ever let them see through your challenges, problems and complexities.

[1] They keep referring to this form as RMA, which I have no clue what it means. Using internal lingo with your customers is a horrible idea. Don’t ever do it!

Why I Decided to Move Away From Evernote

For the last few months things between Evernote and I weren’t as good as they used to be. The direction the company is taking, focusing on enterprise customers, and monetizing its users’ data, eroded my trust in it. Since I use Evernote as the repository for my most personal and precious data, trust is invaluable. And as this factor is gradually taken away, I’ve stopped adding new notes, and sadly started looking for alternatives.

My relationship with Evernote goes way back. I fancy myself one of Evernote’s early users. A productivity nerd, I’ve used it since v.1 back in 2005, when apps were called softwares. Evernote looked a lot different back then. It was designed as one continuous note, imitating a cash register paper roll. This design eased my transition from the physical notepad I used to carry, and turned me quickly into a “power user”, accumulating hundreds of notes every year.

Soon Evernote became the hub for my digital life. I used it to take notes, log ideas, summaries meetings, manage todo lists, maintain contacts information, capture screenshots and whiteboards, and stash passwords. I also created workflows to forward information I wanted to keep track of, such as calendar appointments, text messages, scanned document, invoices, receipts, and workout logs using services such as IFTTT and FileThis. It grew to become an extension of my brain, just what it was built for.

I was a delighted user; so much that I decided to pay for a premium account, even though I didn’t meet my free account’s quota [1], and didn’t need the premium features. Yet I wanted to pay, because I admired the product, and wanted to express my support and loyalty to the team behind it. And more than paying, I became an advocate. I often used Evernote as a showcase for how you can build a big company by focusing your strategy and product roadmap on the user.

Of course, not everything was perfect. I never liked the note taking editor, and even less so as I started to write markdown, which Evernote doesn’t support, and witnessed the proliferation of innovative markdown editors. Keeping track of my notes became another source of grievance. Not being able to organize my notes the way I wanted meant that the more notes I’ve created, the harder it become to keep track of them or find the right note when I needed it. The hundreds of tags and dozens of notebooks I accumulated didn’t make things easier. And my biggest concern was always the lack of portability of my data. Once I put it in Evernote, it was hard to take out. But I wasn’t deterred by these shortcomings, because I knew Evernote’s vision is in line with mine, and therefore trusted those issues will be sorted out eventually.

That’s why when Evernote shifted its roadmap, I started to feel that we don’t share the same vision anymore. At first, there were those small annoyances, such as promoting Evernote’s physical stuff inside the app, and introducing features that work only with Evernote branded hardware. Then more concerning intrusive features, such as “Context” followed. But it wasn’t until Evernote has gone full throttle on sharing and collaboration that I realized it’s time for me to move on.

I’m not very surprised with the change Evernote is going through. You see, for 10 long years Evernote worked diligently to develop an amazing app, believing that’s the only way to build an engaged audience. You can’t build such a user base with less than exceptional product. But as it grew bigger, it got under pressure to show how it translates users into $s. This pressure became unbearable when it started to plan for an IPO.

My speculation is that when Evernote took the IPO route, it found that 100 million users, 5% of them are paying customers, won’t get it the valuation it desires. It won’t, because when evaluating companies, Wall Street doesn’t care about reality and past achievements. It is much more interested in future potential, in dreams. So for Evernote to be priced 10x it’s revenue, it must convince investors that such a dream exists. Now, due to the amount of users it already has, Evernote can’t project an exponential user growth. It can, alternatively, prove it can increase its users’ LTV [2], or show growth in new markets or segments.

Evernote went both ways. On the one hand, it took more aggressive conversion tactics, such as the introduction of a new system of Plus and Premium plans, reduction of the monthly storage of the free plan by 94%, and a new communication strategy that nudges users to convert into one of those paid plans. On the other hand Evernote shifted its focus towards business users, with features such as “Work Chat” and “Team Workspace” that have crept into central position within the app.

As Evernote got itself into the race of cashing in on its users, I lost trust that this will be a service I can rely on for years to come. Hence my decision to jump ship, and seemingly I’m not alone.

I used to quote Phil Libin’s reference to Gus Levy’s brilliant “long-term greedy” strategy. Unfortunately, Evernote’s long-term has arrived, and I don’t want to take part in it.

[1] Back then Evernote offered 1GB to it’s free accounts. Now it’s only 60MB.

[2] Stands for user’s life time value, and is a prediction of net profit you’ll make out of every user you acquire until this user churns.

KPIs and Building Blocks

Few days ago I presented our product vision and roadmap to our R&D group. At the end of my presentation I was asked what gives me confidence that we build the right stuff. I didn’t think too much, and answered that our vision and product roadmap define the what. Knowing our partners and users, I added, and listening to their feedback, problems, and goals help us plan the when. That’s a typical product guy’s answer, yet it’s not a satisfactory one.

The truth is that vision and users’ feedback alone don’t ensure fail-proof products, and you shouldn’t rely on them for that. In fact, much of what you build will fail. The trick isn’t to make perfect predictions, but to take small risks with possible high return. To that end you should obsess yourself over KPIs and building blocks.

Good KPIs are numeric representation of a vision, and therefore serve as your lighthouse. Build something that advances you toward your vision, and your KPIs will encourage you to scale and keep investing in it. If a feature you built, on the other hand, takes you off-course, your KPIs will signal that you should cut your loses short and kill it immediately.

Building blocks means developing stuff that can be reused. This is crucial if you want to minimize risk while moving fast and experimenting with many new features. You can move fast because when you have enough blocks in your arsenal, introducing new features becomes mere integration of existing components, like playing LEGO. The faster you move, the lower your risk is. This is true not only because you have to invest less time and resources in each features, but also because you incur less sunk costs. Say a new feature doesn’t improve your KPIs, you don’t throw it all away. You can remove the feature while keeping its components for later use. Your failure becomes a future investment. On the upside, if a new feature turns out to be successful, you can scale it immediately, since it’s reusable.

Use KPIs to make sure you’re going in the right direction towards your vision. Insist on developing building blocks and you’ll get there at the fastest and most efficient way.

Focus – Not Only Steve Jobs

It seems that Steve Jobs attained a monopoly on the idea of being focused, as many of the articles I read lately on the subject refer to or quote him. Here’s the latest one of them.

I might be breaking some unwritten law now, quoting someone else’s take on what being focused means. I ran into this line in Ayn Rand‘s book The Art of Nonfiction:

When I was writing Atlas Shrugged, I accepted neither day nor evening appointments, with rare exceptions, for roughly thirteen years.

I like this example because not only does it demonstrate extreme focus, suitable for an extreme individual as Rand, but also discipline and persistency. These are complementary qualities without them focus is meaningless. Indeed, Rand’s isolation wasn’t in vain, as it allowed the creation of a book that became an instant bestseller.

Steve Jobs would have liked this example as well, as he himself may have been inspired by Atlas Shrugged when starting Apple…