•
Many of the digital photo frames on the market still don’t have the ability to shuffle images and display them in random order. A couple people I know have frames and want to mix up the photo stream a little. The first time I ran into this issue I used a Windows utility called renamer to assign random names to the image files. But what about a pure Mac solution?
There is one, and you don’t need anything other than OS X to get it done. Skip to the screencast if you prefer - otherwise here’s what you do:
Place the files to be renamed in one folder. It’s best to have them all in one folder without subfolders. If you have images scattered inside subdirectories you’ll have to make some adjustments to these instructions. USE A COPY OF YOUR ORIGINAL IMAGE FILES, there’s no reason not to.
Open the Terminal from your Utilities folder in Applications. Type cd followed by a space. Then drag the folder containing the files from Finder to the Terminal window. Hit return. The Terminal prompt should update to indicate you’re now in the directory containing the images. This folder should NOT BE THE SAME AS THE ONE YOUR ORIGINALS RESIDE IN. Sorry for that, but it’s important.
Finally, type the following command in the Terminal:
for i in *.jpg; do mv $i $RANDOM.jpg; done
The command is case-sensitive. If your images have names ending .JPG you’ll need to adjust the *.jpg part of the command above to use a capital JPG.
Hit return and your image files are renamed using random numbers. Copy them to the digital photo frame and your images should cycle randomly. Thanks to this thread at Mac Rumors Forums.
I’ve included a screencast for those not familiar with Terminal. Be careful in the Terminal. You can delete files accidentally and they won’t be in your Trash ! See this warning for more information.
Screencast
|
Permalink
•
Sometimes Murphy is just a little too lazy to go upstairs and reboot a Mac that needs rebooting. With an iPhone or iPod touch you don’t need to leave the sofa.
Today, Murphy was watching tv on the iPhone via EyeTV’s iPhone app. It started to lock up so a reboot seemed like a good idea. Murphy has Touch Term installed on the iPhone. And the Mac is set to accept SSH sessions. One tap to connect and one command to start the reboot was all it took. Here’s what you need:
- First, go to Sharing in your System Preferences. Turn on Remote Login. This allows your Mac to allow incoming SSH sessions.
- On your iPhone install Touch Term, or some other SSH client. Murphy remembers getting Touch Term for free, but now it starts at $3.99. You might want to comparison shop for similar products.
- Next, configure Touch Term to connect to your Mac, either by name or ip address.
- Once you’ve connected just type the command to reboot your Mac, and press Return. Here’s the command: sudo shutdown -r now
Murphy took the extra step of creating a shell script to run that command, so there’s less to type when it’s time to reboot. That’s all there is to it.
You might want a command to send your Mac to sleep instead of rebooting it. This command should accomplish that: osascript -e 'tell application "System Events" to sleep'
Of course, you can always try something completely different. A long time ago Murphy wrote some posts about using the Mail app on a Mac to trigger events. Murphy has Applescripts on the Mac that do different things when emails come in with certain characteristics. Scripts that adjust iTunes, retrieve files, or put the Mac to sleep. The whole thing was based on a post here.
Some of these scripts had issues with different updates to OS X and changes to Mail. Your results may vary…
I haven’t looked into other ways to reboot my Mac from the iPhone, so if you’ve got a good way let me know.
As always, be careful when using the Terminal.
|
Permalink
•

Mrs. Murphy called and said she wanted to download a file from a Mac back home to her Macbook Air on the road. Away from the house I thought for a second about the easiest way to send her the file. I flicked through my iPhone apps and saw a simple solution.
My iPhone has both TouchTerm and Dropbox (syncs a local folder to the cloud) installed. TouchTerm let me ssh into the Mac at the house which was awake and recording a television show. From there a simple copy command let me copy the file into my Dropbox public folder. That was the hardest part.
Once the file copied over I launched the Dropbox app on the iPhone. The file was listed in my Dropbox public folder - allowing me to use the mail-a-link function in the app. Mrs. Murphy got the email, clicked the link to download her file - and she was all set.
Back when Murphy had more time to tinker he came up with far crazier solutions, like Retrieve a File on Your Mac by Email. Which is still great if you’re up against certain firewall restrictions or other obstacles. Better yet, that solution would have worked as soon as the Mac woke up, had it been asleep.
But this solution required far less preparation. I had ssh running on the remote Mac, and Dropbox was installed on both the Mac and my iPhone. That’s it. I could have used the Dropbox web interface instead of the app.
I realize there are other solutions Mrs. Murphy could have used. Logmein. FTP. VNC. Etc. Everyone has their preference, but I found this direct and efficient.
What do you think?
Get Dropbox
|
Permalink
•
This is a quick way to make encrypting files using the terminal fast and convenient. Murphy posted instructions on making an interactive shell script to do essentially the same thing. This is a slightly different spin. Skip ahead to the screencast to see how easy file encryption can be. The openssl command we’re using is included with OS X.
Like other things we’ve covered - the specific example might not apply to you - but for people who’ve never used a function it might be helpful. Functions can make complicated Terminal commands more convenient to use.
To create the function just add this line to the .bash_profile file in your home directory:
des3() { openssl des3 -salt -in "$1" -out "$2"; }
Note that there’s a space after the opening curly bracket and a space before the closing curly bracket. All we need to remember is the function name, and to provide two file names: one to encrypt and one to be the output file.
The breakdown on the command: the first des3 is what we named the function. We can name it anything but des3 is what Murphy chose. The name of the function is what you’ll type whenever you use it.
The stuff in the curly brackets is what happens when we invoke the function. See this post for more on the openssl command.
The des3 following the openssl command is the type of encryption we’re using. It’s part of the openssl command syntax. We added $1 and $2 after the in and out respectively because they’re the two pieces of information we need when we invoke our function.
The $1 and $2 will be replaced with the paths we type into Terminal. In the screencast Murphy shows how to invoke the function. Instead of typing the paths he drags the file to be encrypted into the window - which saves us the typing. He also names the output file with a des3 extension to remind himself how he encrypted the input file.
As always, be careful with the Terminal if you’re not familiar with it. See Murphy’s warning about the dangerous possibilities.
Watch Screencast
|
Permalink
•

I’ve avoided the tar command for some time now, only to find there’s nothing to be afraid of. My Windows background always led to pkzip for compression and archiving. Knowing that zip shipped with OS X there wasn’t really a need to look any further.
But sometimes you’re sent things in the tar format. Or the even more mysterious tar.gz. If you have no experience with Linux or Unix the tar command and tar.gz files might leave you confused. Before OS X the only experience Murphy had with Linux was hacking a Directv TiVo so he could install a bigger drive.
Anyway - OS X makes tar and tar.gz files simple to work with. Double-click one in the Finder and its contents are extracted. But what if you want to create one? Or see what’s inside before you open it? We’ll do both of those things in the screencast, but here’s a quick overview of some tar basics.
tar -cvf irl08.tar Pictures/ireland_08
That command will create an archive called irl08.tar in the current directory. All the files inside the ireland_08 directory will be placed inside, without compression. The c creates the archive, the v displays progress as files are added, and the f specifies a file as the destination. (tar stands for tape archive)
tar -zcvf irl08.tar.gz Pictures/ireland_08
This command is almost exactly the same, but the z option compresses the archive so we’ve added the customary gz to the file name.
Here’s how to view the contents of a tar archive:
tar -tvf irl08.tar
The t option lists the files. If your archive is compressed add a z option too.
How does tar compare to zip? Murphy isn’t sure what all the differences are. He compressed a directory with dozens of screencasts in it using both utilities. The resulting archive was about the same size for each. The screencasts were already compressed themselves, so they might not be the best test subject.
A little research shows that extracting a single file from a very large archive might be quicker with zip than with tar. A zip file includes a table of contents that makes locating an included file more direct. And a zip file compresses the included files individually as they’re added. A tar.gz file creates the archive first and then compresses the whole thing at once. That can make single file extraction more time consuming as the entire large archive must be opened up.
There’s also gzip for compressing files. But gzip deletes your original file, replacing it with the compressed one. That makes Murphy a little nervous. tar leaves your original files in place, so you can delete them if you need to.
tar. One less thing to be afraid of.
You might find these posts interesting:
zip
command line encryption
Watch Now
|
Permalink