# Perfect Tools Part 2: Actionable Remembering on How to do Things

Have you ever googled for a quick tutorial on how to scp files from one computer to another? Or searched for the right commands to create and switch to a new git branch? What are the perfect tools to do that job? You might say, it depends on what the objective is – scp is fairly different from git.

And you are right. But there are two more things to it. First, you have to find out how it works in order to perform the task. Google is usually your friend here, and I assume that you know how to phrase successful search queries. So what’s the second thing? Performing the task a second or a third time. And forgetting how you’ve done it before. I’m sure that happened to you countless times.

So what’s the perfect tool for the job? It’s actually your favourite text editor, and using it for this job is more of a habit than of an expertise: whenever you found out how to perform a specific task, write it down. Not a long text, just as much as you need to understand as quickly as possible how to do it again. As a bonus, you might want to write a shell script instead that performs the task for you.

The way I’m doing it, is two-fold. I have one directory with text files, describing how to do things. Here are two examples:

•  Git Branching Workflow
git checkout -b NEW_BRANCH
...
git commit -a -m "Finished Work"
git checkout master
git merge NEW_BRANCH
git branch -d NEW_BRANCH
git push
•  Configure Apache on Mac OS-X
sudo apachectl start
cd /etc/apache2/other
sudo nano test.conf
-------------------
NameVirtualHost *:80
<VirtualHost *:80>
ServerName localhost
DocumentRoot /YOUR_WEBSERVER_ROOT
<Directory /YOUR_WEBSERVER_ROOT>
Allow from all
AllowOverride AuthConfig
</Directory>
</VirtualHost>
---------------------
sudo apachectl -k restart

But even better than that is making such notes actionable by writing scripts that do the work for you. I have all my utility scripts in one directory that is included in the PATH variable of my terminal. In fact, all scripts sit in a DropBox folder, so all my machines are always up to date. All scripts are prefixed by “cmd-“, so I can easily find and execute all of them by simply typing “cmd-” in my terminal and then auto-completing the specific task by hitting tab.

Here are a couple of examples:

• Limit your downstream bandwidth (cmd-bandwidth-limit-downstream.sh)
#!/bin/sh
ipfw add pipe 1 all from any to any in
ipfw pipe 1 config bw $1Kbit/s delay$2ms
• Convert video to mp4 (cmd-ffmpeg-mp4.sh)
#!/bin/sh
ffmpeg -i $1$1.mp4
• Find file globally (cmd-find-globally.sh)
#!/bin/sh
find / -name $1 • Find file recursively (cmd-find-recursively.sh) !/bin/sh grep -r "$1" .
#!/bin/sh