« XP, 2G of Ram and Hibernate | Linux Source Code Browsing »
 Nerd Power Ups - Hacking
Posted by Paul on February 26, 2007 12:53 AM PST

powerup.jpg
Even though I've been using computers for longer than I haven't, there are always shortcuts and cool, but unknown features, in the ever increasing amount of software that I come to depend on. Here are some of the tips and tricks that John, J and I have picked up over the years.


Please add yours!

Bash shell



Firefox



Visual Studio



Windows Explorer


vi(m)



Mac OS X



QuickTime



 Comments (21)
John, February 26, 2007 02:03 AM:

More VI(M) powerups:


:set ic -Turn on ignore case for searches

Ctag commands:
:ta [tagname] - edit the file with tagname.
:po - pop to previous location
:ts [tagname] - list the tags that match

Ctag keystrokes:
Ctrl-] - jump to name under cursor
Ctrl-T - pop to previous location

To use above you must have previously built ctags for your source project. For example:
ctags -R *.c *.h

Paul, February 28, 2007 10:11 PM:

Power searching with Firefox using
smart keywords
. Once you use this, you won't go back.

I've extended this to do specialized Google searches, where I want to search only one web site. I'm often looking up API documentation on MSDN, and I don't want other sites to show up in the search results. So, I'll type a query like this into Google:

CreateWindowEx site:msdn.microsoft.com

But typing all that site:... junk is a pain, and I always seem to mistype the word Microsoft. So, I've combined the site specific search with a Firefox smart keyword so that you can type the following into the Firefox address bar to get the same results:

ms CreateWindowEx

To do this:

1. Go to Google and right click inside the search box.
2. Choose "Add a Keyword for this Search".
3. In the Name field, type MSDN search (this name will be displayed in the bookmarks menu).
4. In the Keyword field, type ms.
5. Click OK.
6. Go to the Bookmarks menu in Firefox, and right click on MSDN Search and select Properties.
7. For the Location field, enter this string: http://www.google.com/search?q=%s+site%3Amsdn.microsoft.com
8. Click OK.

The key part is the q=%s in the search query, and that will get filled in with everything after the ms keyword that you type in the address bar.

Paul, March 8, 2007 11:55 PM:

Super awesome vim commands.

Paul, March 9, 2007 03:32 PM:

Gmail power select: to select multiple consecutive email threads, click the Select checkbox of the first thread, then hold down shift and click the Select checkbox of the last thread. Gmail will select (or unselect) all the threads between the two.

Paul, April 11, 2007 01:45 PM:

Mac OS X comes with retarded key bindings for somethings, like having Home/End go to the start/end of the document, instead of start/end of the line.

Fixes for this here and here.

J, April 30, 2007 03:50 PM:

On Mac OS X, hold down ctrl and use the scroll wheel of the mouse, or the two finger track pad scroll. It magnifies the screen and you can scroll around the area magnified.

J, April 30, 2007 03:58 PM:

To list just the subdirectories of a directory in Linux:

ls -d */

To look for text in a bunch of files recursively through directories:
find . -name "*.c" | xargs grep "TODO"

Paul, May 26, 2007 08:38 PM:

Windows Update is really convenient, except when an update is installed that requires a restart of the computer. A dialog then gives two choices: "Restart Now" or "Restart Later". If you choose later, it'll pop up the dialog box 10 minutes later and keep doing so until you finally reboot.

Here is how you can turn off this ridiculous nagfest.

Paul, June 9, 2007 11:19 PM:

Firefox keyboard shortcuts.

Paul, June 9, 2007 11:58 PM:

Web development cheat sheets, from Mr. Mosaic + Netscape himself!

Paul, January 23, 2008 05:58 PM:

Silence the PC speaker beeps.

Paul, October 28, 2008 03:55 PM:

Even better home and end key handling for Terminal.app.

Paul, November 20, 2008 03:34 PM:

When using emacs and X11 on the Mac, you have to do some key remapping so that the meta (alt) key works properly:

1. In X11 preferences: uncheck follow system keyboard layout.
2. In X11 preferences: uncheck enable key equivalents under X11
3. Create the file ~/.Xmodmap, and add the following lines to it:

clear Mod1
clear Mod2
keycode 63 = Mode_switch
keycode 66 = Meta_L
add Mod1 = Meta_L
add Mod2 = Mode_switch

Go this from here.

Paul, February 23, 2009 12:12 PM:

If you find that Visual Studio takes forever to start up or shutdown, delete everything in the following directory:

"Documents and Settings\$USERID\Local Settings\Application Data\Microsoft\WebsiteCache"

While working on Chrome, this directory accumulated tens of thousands of sub directories which VS apparently does something with at start up and shut down. Deleting this changed VS start up from minutes to seconds.

, February 23, 2009 04:33 PM:

Can you make this directory read-only?

Paul, September 25, 2009 11:23 AM:

If you use vi, this page is insanely useful:
http://jmcpherson.org/editing.html

I found a bunch of new useful keyboard shortcuts.

J, September 28, 2009 03:59 PM:

Another VI powerup: remove ^M characters from Mac OS X text files on Linux:
Type : and then
%s/\r/\r/g
From: http://codesnippets.joyent.com/posts/show/1221

Paul, November 30, 2009 04:25 PM:

Mode line ending conversion scripts here.

J, January 3, 2010 12:51 AM:

On netbooks running OS X, some app windows are too large to fit on the screen at once, and cannot be resized (for example the OS X installer!). This little command can be used to scale all subsequently opened windows by a certain factor (1.0 is the default). With the magic of display post script, the whole UI is scaled:
defaults write -g AppleDisplayScaleFactor 0.8

J, April 9, 2010 06:35 PM:

To get output similar to 'cat /proc/cpuinfo' on Linux, on OS X, do the following:
sysctl -a | grep cpu
You can also access this information programatically via the sysctl(3) api.

J, April 9, 2010 06:39 PM:

To view the current built-in defines for gcc, either of the following (obfuscated) lines works:
gcc -dM -E -x c -
:| gcc -dM -E -x c -
Also you can get defines for a specific architecture, for example:
:| gcc -arch ppc -dM -E -x c -


 Post a comment:





All links will be marked with the nofollow tag, making them useless for search rankings. Any posts containing spam URLs will then be deleted.

« XP, 2G of Ram and Hibernate | Linux Source Code Browsing »
Copyright © 2004-2007 Nullstream Group.