Carlos Fenollosa

Carlos Fenollosa

Engineer, developer, entrepreneur

Carlos Fenollosa — Blog

Thoughts on science and tips for researchers who use computers

A simple script to postpone your own email

January 14, 2016 — Carlos Fenollosa

I somewhat use email as a task manager. Honestly, I believe we all do. We process emails in the inbox, then archive or delete them when we are done with them.

However, keeping track of emails that need a follow-up on a specific date can be difficult.

Around 2011 I wrote a script to perform that task. It is a very simple IMAP parser that searches for a folder with today's date and moves all its contents to a special folder named "Today".

Let me tell you my email workflow. I understand that not everybody works in the same way, but maybe you can get some ideas to improve your email handling.

My email folder structure looks like this. The interesting part is in bold.

\_ Mailing lists
\_ Project folders
\_ ...

\_ Deadlines
     \_ Today
     \_ Tomorrow
     \_ 2016-01-19
     \_ 2016-02-02
     \_ 2017-08-01

I follow the GTD methodology, which essentially states that tasks should either be done on the spot, delegated, or deferred. Thus, my inbox is exclusively for new tasks. A couple of times a day I process incoming email and, like most of us, either delete it, reply to it, forward it or —this is the interesting part— move it to one of the "Deadlines" folders.

Instead of using the inbox as the "email task manager", I use a folder named "Today". I've tried both alternatives, and I find that it works best for me. Since it separates new tasks from tasks I've already processed, I can work my entire day on "Today" and totally forget about the Inbox, even if new email is arriving.

The "Tomorrow" folder is just a shortcut so that I don't need to create a new folder with tomorrow's date every day.

As you may have guessed, the script runs once a day in a crontab, at 6 AM, and moves all mail from "Tomorrow" and the folder with tomorrow's date to "Today". That's it. And that "simple trick", as fishy marketers like to say, saves me a lot of time and headaches every day.

There is currently a commercial alternative, Boomerang, which you may find interesting if you aren't comfortable with programming. I haven't used it, so I can't comment on that. In any case, I usually prefer writing a small script rather than using a third-party service.

Update: this script by Alex Kapravelos does something very similar, and it integrates with Google Apps Scripts.

Here it is, as a Gist. The code is definitely not the best in the world, but it works. Feel free to use it, modify it (BSD license), give feedback and leave comments.

I hope that you can introduce some ideas from this methodology to your daily workflow. it can be as useful as it's been for me.

Tags: software, tricks, productivity

Comments? Tweet  

Use whatsapp from the command line

March 10, 2014 — Carlos Fenollosa

Update Oct 2014: Whatsapp changed their protocol and third party clients like yoswup may not work anymore.

In this post I'm going to show you how to run a commandline Whatsapp client. It can be very useful to connect it to a unix pipe and automatically get messages from your server, via Whatsapp. Also, it's cool B-)

Disclaimer: Whatsapp is sending DMCAs to take down Yowsup's Github repos, so either the software or the process may break with any update of their protocol. However, to date, I've been using it for a couple of months with no hassle.

  1. Download Yoswup from Gitorious and extract it somewhere
  2. Edit the config file and input your cc, phone and id. Leave the password blank
  3. We are going to force a re-auth on your phone's whatsapp in order to cache the password. Authenticate with yowsup: ./yowsup-cli -c config -r sms and wait for the SMS
  4. Second step of the authentication: ./yowsup-cli -c config -R [6-digit sms code]
  5. Now your phone's Whatsapp is disabled. Open the app and re-auth with either a SMS or a phone call, whatever is available first. You may have to wait some minutes.
  6. Download iFunBox
  7. Connect your phone, open the iFunBox app in your computer, and navigate to whatsapp/Library/Caches/net.whatsapp.WhatsApp
  8. Copy all files named Cache.db* to some place
  9. Download SQLiteStudio
  10. Open SQLiteStudio, and open the database on Cache.db. Navigate to the table cfurl_cache_receiver_data and scroll to the end. You will see a large json string. This is your current authentication data.
  11. Look on the json string for pw:XXXXXXX. That's your password. Copy it to yowsup's config file
  12. We are ready! ./yowsup-cli -c config -s [cc][phonenumber] "I'm texting you from a terminal"

Enjoy! Yowsup can also be used for full conversations, send messages to yourself which you'll receive on your phone or, as mentioned in the beginning of this post, pipe some other command to your phone.

Tags: software, tricks

Comments? Tweet  

Unix tricks you should be using

February 17, 2014 — Carlos Fenollosa

Some time ago I started a compilation of unix tricks regarding bash completion, obscure tools and some ssh magic.

The list grew bit by bit until it was posted to Hacker News and quickly exploded. It got about 200k visits the first day and has been accessed and linked frequently since then.

I still maintain it, and I'd like to share it again, as the first post of this blog's new era. I have been tempted to re-write it as a longer blog post many times, but I believe that many people were attracted to the simplicity of the original text file.

Tags: unix, tricks

Comments? Tweet  

Redefining your keyboard

June 11, 2012 — Carlos Fenollosa

I live in Spain, so most of the computers I work on have a Spanish keyboard layout. We really need it for the accents, ñ, ç and other language-related keys.

However, when it comes to programming, the Spanish layout seems... designed by Spaniards. Well, not actually. It is designed for writers, not programmers, which makes sense because it follows old typewriter's layouts.

For example, colons need an additional shift key press, the slash is inconveniently located above the number seven, so you need to perform an exercise of finger gymnastics to press it, braces need AltGr, etc. It is very, very inefficient, and it also leads to hand strains and finger pain after a few hours of work.

After some time considering it, I asked for a US keyboard, and voilà, programming is a lot easier now. For me, the major improvement is the location of the slash, widely used in UNIX, but also braces and the pipe. Sure, it takes some time getting used to it, but after about a month of daily use one can perfectly type with, at least, their original typing speed— if not even more—with the included benefit of less finger movement.

Accents can be typed anyway, either by pressing Alt-Letter or mapping them to any other combination. In any case, when I need to type a long text in any language other than English, I just press my layout-change key and use the Spanish keyboard again.

Windows, Linux and Macs allow you to change keyboard layouts on the fly by just pressing a key. With a couple of Google searches you should be able to learn how to do it, it's real easy. However, there's more! I recently discovered another trick which might be useful for your work.

Don't you feel your fingers a little bit tired after working with screen, Emacs or any program which uses Ctrl? That's because the Control key is located down in the keyboard and you need to stretch your fingers to Ctrl-A and Ctrl-E. A hidden feature of all operating systems also allows you to move it up, to the home row of your keyboard. Would you mind checking if there's some key you don't use that often which might be suitable to replace Ctrl? Caps Lock, indeed!

Caps Lock is a huge key which has no practical use except for twelve-year-olds on Youtube, and it is placed so close to A and E that it would be a sin not to make it behave like Ctrl. Again, do a quick Google search, and learn how to remap it. It can be done with the GUI, no need to change configuration files. And, were you in need to use Caps Lock for some reason, you can always map Shift-CapsLock to its old behavior.

From now on, I encourage you to think about remapping keys that you don't use. Personally, I have the Windows key remapped to switch layouts, CapsLock as a Ctrl and the F1..F12 as desktop keys: move one desktop to the left, right, move windows to another desktop, lock screen, volume controls, etc. And, now that you're here, take some time to learn or assign keyboard shortcuts to common tasks, either in the console or in the GUI. You'll work much faster and, more importantly, your hands' health will improve.

Tags: hardware, tricks

Comments? Tweet