Think of this book as a martial arts course for your mind. You might call it the mental arts. Just as the martial arts will teach you to fight without weapons, the mental arts will teach you to think without computers, calculate without calculators, and remember without reading and writing. Of course, some martial arts courses teach you to fight with nunchaku or throwing blades; this book contains a few hacks that will teach you to use notebooks and Perl scripts as tools to become a better thinker.

In many respects, Mind Performance Hacks is a sequel to Mind Hacks by Tom Stafford and Matt Webb, but written with the intention of providing practical hacks you can use, rather than “probes into the operation of the brain” that are more theoretical and fun. (Not that the hacks in this book aren’t fun!) Here again, the martial arts analogy comes in handy. Mind Hacks (also published by O’Reilly) was more a book of beautiful and interesting things you can do with your brain, akin to the branches of the martial arts that are more like dance than combat. Mind Performance Hacks is full of highly practical mental techniques, more analogous to the martial arts meant for self-defense. Of course, this book does contain a few tricks you can flaunt, such as counting to a million on your fingers [Hack #40]—the mental equivalent of breaking a stack of bricks with your hands.

In my effort to become a better thinker, besides the raw impulse to become smarter, I think Frank Herbert’s idea of the mentat has inspired me most. In Herbert’s science fiction novel Dune, set thousands of years in the future, computers have been outlawed and a human profession has evolved to take their place. Mentats are, in effect, human computers, having trained for years to improve their memory, and their mathematical, logical, and strategic abilities, to superhuman levels—in short, to become masters of the mental arts.

In 2004, I started the Mentat Wiki ( as a central repository of information about the mental arts that anyone who happened upon could contribute to. As I had hoped, it attracted a group of contributors interested in mnemonic techniques, mental math, and so on, and since then, the wiki has grown steadily. I’ve learned a lot from the Mentat Wiki, and a number of the mind performance hacks in this book started as web pages there.

I hope you will find at least one hack from this book that you use every day for the rest of your life. If that seems unlikely to you, let me assure you that I use several hacks from this book daily, and I know other people who do, too. Have we attained the superhuman capabilities of Frank Herbert’s fictional mentats? No, but we are more capable than we would be otherwise.

It’s also a dream of mine that the mental arts will be taught commonly in public schools, as the ars memorativa was once taught in classical times. Failing that, it would at least be nice if this knowledge were available in little storefront schools emblazoned with the words “Eight Mental Arts Taught As One!”

Why Mind Performance Hacks?

The term hacker has a bad reputation in the press. They use it to refer to someone who breaks into systems or wreaks havoc with computers as their weapon. Among people who write code, though, the term hack refers to a “quick-and-dirty” solution to a problem, or a clever way to get something done. And the term hacker is taken very much as a compliment, referring to someone as being creative, having the technical chops to get things done. The Hacks series is an attempt to reclaim the word, document the good ways people are hacking, and pass the hacker ethic of creative participation on to the uninitiated. Seeing how others approach systems and problems is often the quickest way to learn about a new technology.

Mind performance hacks are a technology as new as the newest smart drugs and as old as language. In the broadest sense, every time you learn something, you’re hacking your brain. This book is designed to help you learn to hack your brain intentionally, safely, and productively.

How to Use This Book

You can read this book from cover to cover if you like, but each hack stands on its own, so feel free to browse and jump to the different sections that interest you most. If there’s a prerequisite that you need to know about, a cross-reference will guide you to the right hack.

You can attempt most of the hacks in this book with no more than your brain, or at least no more than pen and paper. Many contain references to additional material available in other books or on the Web.

A few hacks also include source code for short computer programs—mainly Perl scripts—that you can use as thinking tools. Don’t worry, though; you don’t need any programming experience to use these hacks. The “How to Run the Programming Hacks" section later in this preface will get you started, and the hacks themselves explain in detail how to install and run the code.

How This Book Is Organized

The book is divided into several chapters, organized by subject:

Chapter 1

This chapter examines ways to improve your ability to remember information ranging from the periodic table of elements to phone numbers, maps, and spatial locations—as well as how not to leave your keys and your cell phone at home.

Chapter 2

It has been remarked that we live not in an information economy but in an attention economy. If you have a broadband Internet connection, for example, you have access to more information than you could ever use, but your attention is comparatively scarce. This chapter contains hacks to minimize the demands on your attention by maximizing your ability to process this deluge of information.

Seed Your Mental Random-Number Generator

Creative thought means the generation of new ideas, from making the space shuttle safe to writing a poem for your kid’s birthday. This chapter contains some useful techniques for almost any creative challenge you might encounter.

Chapter 4

This chapter examines basic hacks to do mental math, including the four-banger operations (addition, subtraction, multiplication, and division), how to check your math, how to count to large numbers on your fingers, and some practical applications, such as calculating the day of the week for any day on the calendar.

Chapter 5

Making decisions with limited data is a problem that everyone faces. The hacks in this chapter will help you separate high-priority from low-priority issues and decide how to take action on those priorities.

Chapter 6

So, you’ve got some great ideas. How are you going to get them across? This chapter will teach you to do so in ways that are clear, creative, or cryptic.

Chapter 7

Passionate emotions can cloud our intellectual clarity, causing us to think poorly. Our thoughts can also be riddled with fallacies and self-contradictions. This chapter contains hacks for gaining the emotional and intellectual clarity and perspective needed to solve problems and make good decisions.

Chapter 8

This chapter contains hacks intended to keep your brain strong and flexible overall, no matter what your age.

Conventions Used in This Book

The following is a list of the typographical conventions used in this book:


Used to indicate URLs, filenames, filename extensions, and directory/folder names. For example, a path in the filesystem will appear as /Developer/Applications.

Constant width

Used to show code examples, equations, logarithms, the contents of files, and console output, as well as the names of variables, commands, and other code excerpts.

Constant width bold

Used to show user input in and to highlight portions of code, typically new additions to old code.

Constant width italic

Used in code examples and tables to show sample text to be replaced with your own values.

Gray type

Used to indicate a cross-reference within the text.

You should pay special attention to notes set apart from the text with the following icons:


This is a tip, suggestion, or general note. It contains useful supplementary information about the topic at hand.


This is a warning or note of caution, often indicating that your money or your privacy might be at risk.

The thermometer icons, found next to each hack, indicate the relative complexity of the hack:

How to Run the Programming Hacks

The few programmatic hacks in this book run on the command line (that’s the Terminal for Mac OS X folks, and the DOS command window for Windows users). Running a hack on the command line invariably involves the following steps:

  1. Type the program into a garden-variety text editor: Notepad on Windows, TextEdit on Mac OS X, vi or Emacs on Unix/Linux, or anything else of the sort. Save the file as directed—usually as scriptname .pl (the pl bit stands for Perl, the predominant programming language used in Mind Performance Hacks).

  2. Alternately, you can download the code for all of the hacks online at There you’ll find a zip archive filled with individual scripts already saved as text files.

  3. Get to the command line on your computer or remote server. In Mac OS X, launch the Terminal (Applications→Utilities→Terminal). In Windows, click the Start button, select Run..., type command, and hit the Enter/Return key on your keyboard. In Unix...well, we’ll just assume you know how to get to the command line.

  4. Navigate to where you saved the script at hand. This varies from operating system to operating system, but usually involves something like cd ~/Desktop (that’s your Desktop on the Mac).

  5. Invoke the script by running the programming language’s interpreter (e.g., Perl) and feeding it the script (e.g., scriptname .pl), like so:

  6. $ perl
  7. Most often, you’ll also need to pass along some parameters—your search query, the number of results you’d like, and so forth. Simply drop them in after the script name, enclosing them in quotes if they’re more than one word or if they include an odd character or three:

  8. $ perl '"much ado about nothing" script' 10
  9. The results of your script are almost always sent straight back to the command-line window in which you’re working, like so:

  10. $ perl '"much ado about nothing" script' 10
         1. " Books: Much Ado About Nothing: Screenplay ..." 
         2. "Much Ado About Nothing Script" 


The ellipsis points (...) signify that we’ve cut off the output for brevity’s sake.

  1. To prevent the output from scrolling off your screen faster than you can read it, on most systems you can pipe (redirect) the output to a little program called more:

  2. $ perl | more
  3. Hit ^ and the Enter/Return key on your keyboard to scroll through line by line, the spacebar to leap through page by page.

  4. You’ll also sometimes want to direct output to a file for safekeeping, importing into your spreadsheet application, or displaying on your web site. This is as easy as:

  5. $ perl > output_filename.txt
  6. And to pour some input into your script from a file, simply do the opposite:

  7. $ perl < input_filename.txt

Don’t worry if you can’t remember all of this; each programmatic hack has a “Running the Hack" section that shows you just how it’s done.


Fancy trying your hand at a spot of programming? O’Reilly’s best-selling Learning Perl ( by Randal L. Schwartz, Tom Phoenix, and brian d. foy provides a good start.

Using Code Examples

This book is here to help you get your job done. In general, you may use the code in this book in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission.

We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: "Mind Performance Hacks by Ron Hale-Evans. Copyright 2006 O’Reilly Media, Inc., ISBN 0-596-10153-8.”

If you feel your use of code examples falls outside fair use or the permission given here, feel free to contact us at

Safari Enabled

When you see a Safari® Enabled icon on the cover of your favorite technology book, that means the book is available online through the O’Reilly Network Safari Bookshelf.

Safari offers a solution that’s better than e-books. It’s a virtual library that lets you easily search thousands of top tech books, cut and paste code samples, download chapters, and find quick answers when you need the most accurate, current information. Try it for free at

How to Contact Us

We have tested and verified the information in this book to the best of our ability, but you may find that features have changed (or even that we have made mistakes!). As a reader of this book, you can help us to improve future editions by sending us your feedback. Please let us know about any errors, inaccuracies, bugs, misleading or confusing statements, and typos that you find anywhere in this book.

Please also let us know what we can do to make this book more useful to you. We take your comments seriously and will try to incorporate reasonable suggestions into future editions. You can write to us at:

O’Reilly Media, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
(800) 998-9938 (in the U.S. or Canada)
(707) 829-0515 (international/local)
(707) 829-0104 (fax)

To ask technical questions or to comment on the book, send email to:

The web site for Mind Performance Hacks lists examples, errata, and plans for future editions. You can find this page at:

For more information about this book and others, see the O’Reilly web site:

Got a Hack?

To explore Hacks books online or to contribute a hack for future titles, visit:

Get Mind Performance Hacks now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.