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:
Type the program into a garden-variety text editor: Notepad on Windows, TextEdit on Mac OS X,
viorEmacson Unix/Linux, or anything else of the sort. Save the file as directed—usually asscriptname.pl (the pl bit stands for Perl, the predominant programming language used in Mind Performance Hacks).Alternately, you can download the code for all of the hacks online at http://www.oreilly.com/catalog/mindperfhks. There you'll find a zip archive filled with individual scripts already saved as text files.
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.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).Invoke the script by running the programming language's interpreter (e.g., Perl) and feeding it the script (e.g.,
scriptname.pl), like so:$
perlscriptname.plMost often, you'll also need to pass along some parameters—your search query, the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access