On Readable Python Code

Standard

Python is an very nice high-level programming language that provides the user with an easy way to write readable and clean code. It is often the case when someone is learning a new tool or language that they are not aware of small features that would greatly improve the readability of their code.

For example, when I was learning Python I learned to iterate over a list the way I keep seeing it when reading code of beginner Pythonists. Here is an example of how you could iterate over the list:

for ix in range(len(a_list)):
    print(a_list[ix])

However, a better and Pythonic way is to use iterators:

for el in a_list:
    print(el)

This equally works for dictionaries and strings:

for key in a_dictionary:
    print(key)

for char in a_string:
    print(char)
Advertisement

Evernote in Linux

Standard

For some reason Evernote doesn’t seem to care about Linux users. They prefer to work on their (slow) web interface. I don’t understand how much harder is it to modify the Mac app for Linux?

The main reason I am writing this post is not to describe the available Evernote interfaces for Linux but to introduce a SublimeText package for Evernote and share a snippet I’ve made.

There is already some articles out there that describe the Evernote gui alternatives like this & this. So it suffices to just list them:

  • NixNote2
  • Everpad: includes a Unity lens but it doesn’t work in Ubuntu 15.04
  • Geeknote

Continue reading

Distraction Free Email Composition with Gmail

Aside

As you can see, I am writing an email in Gmail without the standard Inbox in the background. This is a nice hack if you want to send an email without unintentionally glimpse your full inbox. To achieve this simple use the following url:

​​https://mail.google.com/mail/u/0/?view=cm&fs=1&tf=1

To do this easily, simple bookmark the page and use that bookmark whenever you want a distraction free email composition with Gmail. ​​ PS: After sending you email you can write a new one by simply refreshing your page. Happy Emailing — Sincerely Yours, Ibrahim Selection_026

Tip from a reader (Marc): If you want a similar solution when replying to a email, simply pop-out the reply window then clicking the double-arrow icon in the upper right corner while pressing the shit key as shown in the images below.

An easier keyboard-based solution is Shift+r.

Linux tip: find your bash command in less than 3 seconds

Standard

Many Linux users usually need to repeat the same command over and over again. For the newbie she will often re-write the whole command. The average use might already know that there’s something called a bash history and so she would use the up and down arrows to navigate through the history. It will take a while to find the needed command.

The more advanced user would know the trick I am about to tell you to find the appropriate command in less than 3 seconds.
Continue reading

Tip: Evernote and Daily the review

Aside

Yesterday, I learned a new and useful Evernote trick from science fiction writer and Evernote ambassador Jamie Todd Rubin.

The trick is from his article Going Paperless Quick Tip: How I Do A “Daily Review” in Evernote. The trick is to create a saved search which makes the daily review in Evernote a click away. The daily review concept is referenced to the Getting Things Done (GTD) system by David Allen.

The daily review, as the name implies, is to review all of what you have received or created during your day to keep things in place and on track. For example you might have received some mail or have created some notes.
All this has to be processed at some point (preferably daily) otherwise, you will lose track of all the input you have received especially those that need some action on your behalf.

In regard of Evernote, Jamie (and now myself) uses a saved filter to process his daily notes. To do this he made the following search:

any: created:day updated:day

This search returns all notes that were created and updated/modified “today”. You can then save the search and add it as a shortcut which makes it very handy once you’re ready to do the daily review.

I tried to do the search on my Android phone and tablet but it didn’t work. Nevertheless, once you do this on the web app you will also have the saved search on all of your devices which is really useful.

You can read more of Jamie Rubin’s articles on the “Daily Review” on his website.

Thanks to Jamie Todd Rubin.