Fix (Error code -36) on OS X with dot_clean

The error stems from the way OS X stores files.  If you have ever seen Apple files on a PC, you may have seen files beginning with a “._” dot-underscore.  While this problem was seen on Snow Leopard, I recently saw this issue after trying to use Migration Assistant to transfer a user multiple times.  The dot_clean  command seemed to solve the issue per the article linked to above.  The command was new to me, but it basically “…recursively merges all ._* files with their corresponding native files…” Continue reading “Fix (Error code -36) on OS X with dot_clean”

List Open Files By User

The command lsof  lists open files.  However, even if you use the -u option to show files open by just the user, there is a lot of files used in the background that you don’t really know about.  I wanted to parse this down to get just the files I had open in the GUI.

Below is the command I came up with to give me a concise list of files I have open:

lsof -u your_username | awk '{print substr ($0, index($0, $5))}' | grep "/Users/your_username/" | grep -v "DIR" | grep -v "/Library/" | grep -v "/Applications/" | grep -v "/.dropbox/" | uniq | awk -F'/' '{print $NF}' | sort

Continue reading “List Open Files By User”

Apple Remote Desktop Not Finding Computers? Try This

Apple Remote Desktop has become flaky over the last few versions of OS X.  Apple isn’t really working on it anymore.  It is still a great tool, but often, it will have difficulties finding computers on the network.  Here is what I do to make it work a little better. Continue reading “Apple Remote Desktop Not Finding Computers? Try This”

Batch Rotate Photo Files With Hazel and sips

If you have a ton of photos that are all facing the wrong direction and don’t want to do them individually, you can use Hazel to automatically go through a folder and rotate the images for you.  All it takes is a one-line bash script and a Hazel rule.

sips -r 90 "$f"

This rotates the image 90 degrees.  You can set it to 180 or whatever else you want. Continue reading “Batch Rotate Photo Files With Hazel and sips”

Trigger Scripts Via Dropbox And Hazel

I haven’t found a great use for this yet, but you can have your Mac automatically run a script by simply creating a file/folder in your Dropbox.  To do this, you need to set up Hazel to watch your Dropbox folder for a certain file/folder, and if it appears, trigger a script.  You could also use folder actions, or launchd, but it will be much more challenging.

In the example below, I simply play a sound byte of the Borg claiming that resistance is futile. Continue reading “Trigger Scripts Via Dropbox And Hazel”

OS X Mail: Create HTML-formatted Auto-response With AppleScript and Rules

Do you respond to a lot of emails with the same or similar content?  You can use Apple’s Mail app to do this for you automatically with some AppleScript and email rules.  Hopefully, you already know about the privacy glitch associated with Apple’s Mail program and Spotlight and have disabled the indexing of your emails.  If not, do that now.  Then, follow the instructions below. Continue reading “OS X Mail: Create HTML-formatted Auto-response With AppleScript and Rules”

Generate Random Number With Bash Script

I use this script to generate random numbers.  This is useful if something needs a random time delay (for network performance issues) or choosing a random selection from a case  statement.

let "number %=$RANGE"
echo "$number is a random number less than $RANGE"

Continue reading “Generate Random Number With Bash Script”

Reduce And Resize Dropbox Camera Uploads Automatically With Hazel

I usually use my iPhone to take pictures for my Website and then upload them via the Dropbox app so they appear on my computer.  This is a nice feature, but the photos are way too large to use on a Website.  Instead of opening each one in Preview, scaling it down and saving it.  I created a Hazel workflow that does this for me automatically.  It then copies the original file to the Photos folder. Continue reading “Reduce And Resize Dropbox Camera Uploads Automatically With Hazel”