This hint is motivated by this earlier hint, and other stuff I've read elsewhere. I created a csh alias to search via Spotlight. Results are returned in chronological order and logically grouped.
Here is a detailed description of the construction of the alias, so that readers can modify it to suit their own needs. The alias has five parts connected by four pipes. To reassemble the alias, put the five parts on a single line and add it to your .cshrc file.
As a summary, here's how it works. If one types:
$ spot xanadu
mdfind is asked to find all files in the current directory containing xanadu in their metadata. The output is piped to ls -lt, to sort it into chronological order (most recent at the top). The result of this is then piped to sed for tidying. Read on for the details...
I was looking for an AppleScript that would just show me the duplicate entries in my Address Book, and not delete them out of hand, since some have different information yet the same name. I could not find one, but found this great gem from Apple Developer Documentation - Apple Script:
osascript -e 'tell app "Address Book" to get the name of every person' \
| perl -pe 's/, /\n/g' | sort | uniq -d
It will give you a nice listing of every duplicate entry in the Address Book, making it easier to sort through them for information and delete them individually.
[robg adds: Address Book's Card: Look for Duplicate Entries feature doesn't provide much information at all prior to merging -- it will just say "one duplicate card was found; do you want to merge this data?," without telling you which cards are duplicates. This script will let you verify which cards may be merged, prior to doing so. Note that the script is based simply on name matches, so you may see more duplicates listed via its ouput than you would with Address Book's duplicate feature.]
I love GeekTool and use it all over my desktop. So I thought that I'd share the script that I use to keep the status of my network interfaces on my desktop at all times. Please pardon the fact that it's written in csh, but I'm a long-time SunOS user, and that's what I use for most of my quick and dirty stuff.
You may have noticed in a few rare instances your cursor in X11 becomes a transparent yellow outline. This is caused by a byte-order bug in Xquartz, in the instance your remote machine changes the cursor's appearance using an image rather than just a bitmap. (RedHat Linux systems do this to get a neat blue facet.)
Use the following if you have this problem. Do not apply this fix if you're running a PowerPC Mac.
Quit X11. Grab this file (2.7MB)) using Safari or command-line wget, then run this command:
sudo tar zxvf xfix.tar.gz -C /
Restart X11. The new binary simply adds a loop of ntohl() to the ARGB image in load_cursor(). A simple modification to quartz-cursor.c, found in X11-0.40.2 -> xc -> programs -> Xserver -> hw -> apple.
This is not my hint, but I'm reporting it here after seeing it posted elsewhere. Phillip Moore found a solution for occasional tcsh: no more processes and similar errors. Check his original post for details and the discussion.
One modifies /etc/launchd.conf by adding this line:
limit maxproc 512 2048
A restart is then required to activate the new settings. Or find some other way to restart launchd, which I didn't feel comfortable doing. I'd run into this problem sometimes after opening multiple Terminals and running a bunch of shell scripts.
[robg adds: As Phillip notes on his page, you only need to do this if you've run into the 100 process limit before; there's no other reason to do it. Visit his page for more details on the settings...]
Everyt ime I have come across hints about textutil, I have tried to use it for converting text files between different character encodings.
According to the documentation, textutil should be perfect for this. However, it has never worked. Until now. It seems like the -format and -convert flags must be specified, too. This example converts a macroman encoded file to latin-1:
I've found an easier way to check an md5 sum, or any other checksum for that matter. Just use this command:
md5 file_to_check | grep checksum_of_file
If there is an error, it will show the file name and the real checksum of the file. If there aren't any errors, then nothing will show up. You can do this for mutliple files by putting a semicolon (;) between the above code for each file.
I first learned about textutil in Mac OS X 10.4 in a tip here on macosxhints.com.
textutil is a rosetta stone for converting between different text file formats. For example, I recently wanted to change 36,000 .doc files into text files. So I needed to come up with a way of recursively converting all the files. The unix find command can be used to feed textutil. In Terminal, navigate to the appropriate directory (since this uses the current "." directory), and enter this command:
It has always annoyed me that a simple calculator would take several seconds to load on my current machine, and yet MacOS Classic's calculator is instantaneous even on my 33mhz 68k Mac. xcalc is also instantaneous, but requires x11 to load, which takes a while.
As I'm always running Terminal.app anyway, I thought a terminal calculator with a 'GUI' would be nice. After googling for it with no luck, I decided to write a shell script that mimics the behavior of a simple calculator. It loads instantly even on a iMac 233, although screen redraw can be a little sluggish on such hardware.
I'm not a developer in any way, so the code is probably the ugliest thing ever written, but it works for me. It handles only the basic 4 operations with 5 decimal cases. type 'q' to quit, the rest should be self explainable. Improvements are more than welcome -- for example, I couldn't map the clear key in the numeric pad, so I used 'c' for clear.
[robg adds: I mirrored the script here on hints. Remember to make it executable first (chmod a+x tcalc). I tested it, it seems to work well, and it is indeed speedy.]