Access Linux from Mac OS X Finder
I run a Linux server in the house which I use for all sorts of things–a staging server, git server, backup and file server–all of which works well enough for me as a geek. But for the wife and kids, who are not into shell commands (for whatever reason), the server is of no use if they can’t use it via Finder.
For that there are two nifty packages that make browsing your Linux machine from an your mac as easy any other mac on the network. One package, called `netatalk` installs makes your Linux box AFP capable (Apple Filing Protocol), the other, called `avahi`, makes your Linux box discoverable, `bonjour` style.
I’ve been using these packages for a while now and until recently, setup has been sketchy and stability hasn’t been all that great. In recent months however, this has changed considerably and now both packages work (and work well) almost right out of the box. So here are some step-by-step instructions for making your Linux box discoverable and browsable by Mac computers on the network:
1. If you are on the Linux box, starr a shell, otherwise ssh into your Linux box.
2. Get the `netatalk` and `avahi` packages (check first to see that they’re not installed already).
$ sudo apt-get install netatalk avahi-daemon
3. Configure netatalk.
$ sudo vim /etc/netatalk/afpd.conf
Uncomment the default line or create your own parameter string (⇧G in VI will move the cursor to the end of the file).
- -tcp -noddp -uamlist uams_dhx.so,uams_dhx2.so -nosavepassword
4. [optional] Configure the volumes to share. By default netatalk sets some basic user privileges and directories to share. You can customize these to your liking.
$ sudo vim /etc/netatalk/AppleVolumes.default
5. Start the AFP and Bonjour services.
$ sudo /etc/init.d/netatalk restart ; # starts netatalk
$ sudo restart avahi-daemon ; # restarts avahi-daemon
Now look at Finder on your Mac and you’ll see your Linux box in the “Shared” list in the Finder sidebar.
For more on these two packages, visit the [Netatalk][] and [Avahi][] websites.
[Netatalk]: http://netatalk.sourceforge.net/
[Avahi]: http://avahi.org/
Lion Recovery Disk Assistant
“Built right into OS X Lion, Lion Recovery lets you repair disks or reinstall OS X Lion without the need for a physical disc.
The Lion Recovery Disk Assistant lets you create Lion Recovery on an external drive that has all of the same capabilities as the built-in Lion Recovery: reinstall Lion, repair the disk using Disk Utility, restore from a Time Machine backup, or browse the web with Safari.” — via Lion Recovery Disk Assistant.
Mac Mini Vault – Apple TV Webserver.
“One of the fun projects going on at Mac Mini Vault is our Apple TV webserver. As much as we’d love to see how many Apple TV’s we could mount into a data center cabinet, it will never be a sustainable service to offer. This project was a fun way to see how far we could take the A4 powered Apple TV. The Apple TV is running iOS 4.2.2 obviously jailbroken with lighttpd for a web server. You can see the webpage we set up by visiting atv.macminivault.com. We’ll keep an eye on the CPU load and watch the analytics to record how much traffic the Apple TV receives.” — via Apple TV Webserver..
Again, some of [those on twitter](https://twitter.com/devi8/status/88606517451956224) know me all too well. Thanks (again) to @DEVi8 for showing me this one.
Apple Baked Oatmeal
Shared by rbngndl
Ingredients
- 1 C home made applesauce with cinnamon/sugar
- 3/4 C brown sugar
- 1/2 c white sugar
- 4 eggs
- 6 C quick oats
- 4 tsp baking powder
- 1 tsp salt and cinnamon
- 1 tsp cinnmon or 1/2 cinnamon and 1/2 apple pie spice
- 2 C milk
- 2 apples peeled and chopped (I like granny smith)
- 2 C coconut
- 1 -2 C craisins or raisins
- 1/2 C chopped walnuts or pecans
Directions
- Beat together 1st four ingredients. Add remaining, mix well. Add apples, coconut, craisins last. Sprinkle nuts on top and pour into greased 9 x 13 and cover and refrigerate overnight. Remove from refrigerator while you preheat the oven. Or go ahead and bake at 350 for about 45 minutes or until center is set.
Search, share, and cook your recipes on Mac OS X with SousChef!
[tags]breakfast,apple,oatmeal,recipe[/tags]
RapidWeaver Add-ons Version Identifier
One thing RapidWeaver does poorly — at this current moment — is help the end user determine the product version they are using on any given 3rd party add-on. Knowing your add-ons (theme or plugin) version number is critical when asking for support and is often one of the first things the developer will ask you for.
If you know where the add-ons are kept (`~/Library/Application Support/RapidWeaver/`) then you might be able to determine a plugin or themes version number with the Finder, or if you have RapidWeaver open you can find out a plugin’s version by opening the plugin browser, or if you show a themes package contents and…
Well, I like to have these sorts of things at my fingertips and do as little thinking as possible, so I wrote an AppleScript to gather this information for me no matter where I am or what I am doing[*][a_091103113228]:
– file types to choose from
set rwTypeArray to {“Theme”, “Plugin”}
– choose from those file types
set rwTypeLong to {choose from list rwTypeArray ¬
with prompt ”Which RapidWeaver product type ¬
you like to find the version of?” ¬
with title “Theme or Plugin”} as string
– logic from result
if rwTypeLong is “Theme” then
set rwType to “rwtheme”
else
set rwType to “rwplugin”
end if
– get name of hard drive
tell application “System Events”
set diskName to (get name of startup disk) as string
end tell
– get name of user
set userName to (do shell script “whoami”) as string
– select file from RW directory
tell application “Finder”
set rwFile to (choose file with prompt ¬
“Please select your RapidWeaver ” & rwTypeLong & “:” ¬
default location (diskName & “:Users:” & userName & ¬
“:Library:Application Support:RapidWeaver” as alias) ¬
of type rwType without invisibles)
– read version number
tell application “System Events”
set rwInfo to (get version of the file (rwFile as string))
end tell
– and display it
if rwInfo = “” then
display dialog ¬
“It seems that your ” & rwTypeLong & ¬
” doesn’t have a version number that I can read. ¬
Sorry.\n\n¬
Would you like me to reveal it’s ¬
package contents for you?” ¬
buttons {“Cancel”, “Yes”} default button (2)
set rwPath to rwFile & “Contents” as text
open rwPath
else
display dialog “The version information:\n\n” & rwInfo & ¬
“\n\n …has been copied to your clipboard.” ¬
buttons {“OK”} default button (1)
– copy to clipboard
set the clipboard to rwInfo
end if
end tell
### Notes ###
* If a theme is to have it’s version number read, it must have an Info.plist in it’s package contents. Some theme developers do not include this file. For those that don’t, the script will reveal the theme’s package contents so that you can inspect the version number at the bottom of the Theme.plist file
### Download ###
Get your fresh copy of [RapidWeaver\_Addons\_version.scpt][a_091103112457] from CodeCollector.net
[a_091103112457]: http://www.codecollector.net/view/BB433BE1-0BD0-43C6-AE7A-CFEE8E623AB8 “RapidWeaver_Addons_Version.scpt”
[a_091103113228]: http://seydoggy.com/2009/11/03/rapidweaver-add-ons-version-identifier/#a_091103113228
Creating Unique ID's For… Anything!
There are numerous reasons you might need a unique identifier on something; you upload files with common names to the same ftp site, you use the id attribute for internal links on a blog that might display multiple posts (the chances of repeating yourself are good), you want to sign your emails with a unique, one time id for your own verification… Whatever the case, a unique id could come in handy.
The easiest thing to do is use a timestamp and a shell script can do that easily enough for us. For everyday use, the year, month, day, hour, minutes and seconds should suffice (unless you need multiple unique id’s per second). Here is how the bash script would look:
date +%y%m%d%H%M%S
Entering this string into the Terminal.app would yield a twelve digit number like this:
091027191546
The first pair of digits is the year, the second pair is the month, the third pair is the day, then the hour, minutes and seconds (all in pairs). Run this script in Terminal.app as many times as you like and you will never get the same number.
So you could enter this into your terminal every time you wanted a unique id… or you could make this shell script work *for* you from anywhere.
## TextMate Snippet ##
TextMate makes running shell scripts dead easy — all you need to do is create your own snippet. To do this:
* open your Bundle editor — `Bundles > Bundle Editor > Show Bundle Editor` ***or*** `⌃⌥⌘B`
* create a new bundle (if you don’t already have your own) from the + icon
* within that bundle create a new snippet from the + icon
* in the edit window, type:
`date +%y%m%d%H%M%S`
* define a Tab Trigger or Key Equivalent
* leave the scope selector blank to have the snippet apply to all language types
Now you have a snippet that is accessible in any language scope you use TextMate for. This is handy if you write reference links in HTML articles, such as:
Or for reference style links in MarkDown:
Check out our site, [seyDoggy][a_091027194631], for some
really cool tips and tricks.
[a_091027194631]: http://www.seydoggy.com/ “seyDoggy’s really cool site”
### Download ###
Download your fresh copy of “[Unique ID.tmSnippet][a_091027205118]” from seyDoggy.com.
## AppleScript to clipboard ##
Say you’re not a TextMate user but you still want a quick way to run this shell script with as little effort as possible. AppleScript makes quick work of this task with it’s `do shell script` functionality. We need to make an AppleScript that runs the shell script, then copies the results to the clipboard. Then we can paste that result into what ever we’re working with at the time; file renaming, email signing, etc…
Here is how the script looks:
set uniqueID to (do shell script “date +%y%m%d%H%M%S”)
set the clipboard to uniqueID
display alert “\”" & uniqueID & “\”" & “Has been copied to your ¬
clipboard” giving up after 1
### Download ###
Get your fresh copy of “[UniqueID.scpt][a_091027205534]” from CodeCollector.net
[tags]applescript,shell,script,textmate,snippet,terminal,unique id[/tags]
[a_091027205118]: http://www.seydoggy.com/downloads/UniqueID.tmSnippet.zip “Download from seyDoggy.com”
[a_091027205534]: http://www.codecollector.net/view/55260B3D-599D-489A-BC7E-C51AF597B2D0 “Download from CodeCollector.net”
Enabling Double Arrows in the Scroll Bar
Ohh, ohh, ohh, I can’t forget this one! This is one of those options you forgot you enabled with a utility like [Onyx](http://www.titanium.free.fr/pgs/english.html “Titanium Software”). So when you go and do your clean install of OS X and realize that some things are just not the same as they were, it’s the the little things like having double arrows at the top and bottom (or left and right) of a scroll bar that you miss.
Having vowed to take matters into my own hands with this install and being acutely aware of every system hack I make, I am documenting everything I do (on this blog) and I am making sure it’s something I can control via the terminal. So, instead of using Onyx, here is the terminal hack for enabling double arrows in your scroll bars:
defaults write "Apple Global Domain" AppleScrollBarVariant DoubleBoth
If you ever need to go back you just open the System Preferences (`/Applications/System Preferences.app`), click on appearance and choose one of the two defaults from “Place scroll arrows:”; “Together” or “At top and bottom”.
Auto mount/unmount your Mac volumes when required
Earlier this month you might recall the solution I gave you for [keeping unused volumes unmounted](http://www.seydoggy.com/2009/02/12/keeping-unused-hard-disks-unmounted/ “seyDoggy Web and Graphic Design – seyDoggy weblog – my thoughts on the web and the mac”) on your mac. The next part of the equation, automatically mounting those volumes when needed to run my backup scheme, took me a little longer to sort out. In fact I wasn’t able to write a solution on my own, try as I might, so I finally went searching for one.
I needed a script of some sort that would mount my unmounted volumes when it was time for [ChronoSync](http://www.econtechnologies.com/pages/cs/chrono_overview.html “ChronoSync | Perform File and Folder Synchronizations and Backups Like Clockwork | Econ Technologies”) to run and then unmount my volumes when ChronoSync was finished. After several IRC queries, forum posts here and there and countless Google searches I finally stumbled upon [this post](http://www.macosxhints.com/article.php?story=20060308154312630 “macosxhints.com – A script to mount/unmount a volume on app launch”) at Mac OS X Hints. This solution was the answer I needed and it works perfectly. I won’t recap the whole thing here, but I will give you the bits that were most important to me.
Copy the following script into *Script Editor.app* (`/Applications/AppleScript/Script Editor.app`), changing the `diskname` and `appname` to suite your needs:
property diskname : "MyDisk"
property appname : "ChronoSync"
on idle
tell application "System Events"
set x to the name of every process
if appname is not in x then
if (exists the disk diskname) then
do shell script "disktool -l | egrep -i "Mountpoint = '/Volumes/" & diskname & "" | cut -d\' -f2 | xargs -n1 disktool -p"
end if
else
do shell script "disktool -l | egrep -i "Mountpoint = '', fsType = 'hfs', volName = '" & diskname & "" | cut -d\' -f2 | xargs -n1 disktool -m"
end if
end tell
end idle
Next you need to save it as a bundled app and select “*Stay Open*”, give it a useful name and save it where you will be able to find it. In my case I chose `/Library/Scripts/ChronoSync/`:

Then you have to make it run in the background. To do this, find your newly created app, right click on it, “*Show Package Contents*”, find the Info.plist and open that in your favorite plain text editor. Above the key that says `CFBundleAllowMixedLocalizations` you want to add the following:
<key>LSBackgroundOnly</key>
<string>1</string>
Get out of the package and find your app again and double click on it. It should launch in the background but not show in the dock. You can see that it’s running by opening *Activity Monitor.app* (`/Applications/Utilities/Activity Monitor.app`):

Now to truly make this process automated, you need this app to be on when your computer is on, so it needs to launch when you login. So open your Accounts preference pane in System Preferences.app (`/Applications/System Preferences.app`), select the *Login Items* tab, select the  button and add your newly created app:

And that’s it! Next time your backup program fires up to do it’s regularly scheduled backups, your disk mounting app will mount your volume, wait for your backup app to finish and then quietly tuck your volume back up for the night.
##Other references
1. [A Script to mount/unmount a volume on app launch](http://www.macosxhints.com/article.php?story=20060308154312630 “macosxhints.com – A script to mount/unmount a volume on app launch”)
2. [An AppleScript to mount, run, unmount a disk image](http://www.macosxhints.com/article.php?story=20040905112951299 “macosxhints.com – An AppleScript to mount, run, unmount a disk image”)
3. [MountPart](http://www.well.com/~jfw/software/mountpart/ “John F. Whitehead – MountPart – Mount/Unmount Individual Partitions”)
AppTrap; the unistaller that makes sense
One thing that’s become increasingly important to me over the years is uninstallers. If an app doesn’t come with one I am reluctant to install it. It became [painfully clear recently](http://www.seydoggy.com/2009/02/10/rebuilding-after-all-of-these-years/ “seyDoggy Web and Graphic Design – seyDoggy weblog – my thoughts on the web and the mac”) just how much crap application leave behind when you are done with them and banish them to the trash.
In the last few years a number of apps have cropped up that not only remove the app, but all of it’s associated plist files and folders and what ever peripherals the app has added to your system. I have been using [AppZapper](http://www.appzapper.com/ “AppZapper – The uninstaller Apple forgot.”) for no better reason than in was there, packaged with some Delicious Generation bundle of the time (probably [Macheist](http://www.macheist.com/ “MacHeist » Welcome”)), but it always struck me as odd that I would have to open an app to move another app to the trash. I presume it’s just to show off their artwork and screen flashy effect more than any practical reason. But to me it just seems like one step too many.
In my hunt for something smarter, I came across [AppTrap](http://konstochvanligasaker.se/apptrap/ “AppTrap”). This just makes sense to me. It sits in waiting, in your preference pain and if you happen to drop an app in the trash, it pops up and asks if you to get rid of the other crud that goes with it. How smart is that?
I Give Apples New Safari 4 Beta a Spin
Apple announced today the launch of their [Safari 4 beta program](http://www.apple.com/safari/ “Apple – Safari – Introducing Safari 4 – See the web in a whole new way”) that claims to lead the way with innovation. I had to test this claim so I immediately downloaded it and gave it a spin. Here are my findings:
* On initial launch you are presented with the “Top Sites” window in which it appears that Safari scours your history for the most frequently visited sites in your recent cache and then throws up their thumbnails in a Core Animation like black gallery for you to pick from. Selecting the edit button allows you to remove items and make others sticky. I presume you can also add others that might actually be more indicative of your “Top Sites”. Again, in true Apple form, Apple seems to be hinging the success of a product on visual wow factor, but admittedly I could see myself making use of this.
* My next reaction was when I created a new tab and found that, a la Google Chrome, the tabs are on top. Why? While I will most certainly get used to it, what is the actual reason for this? I can’t find and difference in their functionality apart from the fact that you can only drag them about from their corner. Aside from that you can still drag them, move them from window to window, create a new window with each tab… there is one option I hadn’t noticed in previous version, “Add bookmark for these X tabs”. Is that new?
* Coverflow in Safari… there have been a few plugins to address this in the past. I guess they are history now. Do I need Cover Flow in Safari? I don’t need it iTunes or Finder so I probably won’t use it here either. But that said, it must be a popular enough technology if they keep throwing it in to their software.
* History search. Now *that* I like! I have always found searching the the history in the bookmarks folder to be painful and unproductive. This history search is insanely fast and (in Cover Flow form) even shows you screen shots of the sites that match your search terms.
* It claims to be faster, using the Nitro Engine. It could be but browsers and web technology today is getting so fast I would be hard pressed to notice the difference. It does seem to be faster overall but am I reacting to the guts of a finely tuned OS X Cocoa application or the page load? One note I will make about making browsers faster (and Safari 3 is already guilty of this), they cache things… unnaturally so which can make web development a nightmare. Safari 3 already caches it’s javascript and images in ways that cause web developers to have to reset their browsers all too often just to get an accurate response on their new projects. And faster also means pre-load, again which Safari 3 is bad for. Safari 3 will scour your main CSS file in search of things to load (like background images), whether or not that _thing_ is actually needed or even being used. I hope Safari 4 handles this a little better.
* The newish developer tools are nice (if your weren’t already playing with them in webkit), but I don’t know… it’s still not FireBug. You still can’t select code in the element window! How good is debuggin if I can’t edit what’s there or even copy and past it to a text editor? Seriously? As far as developer tools, these will give a glimpse into how your page is working, but they’re not much good for anything else.
* The full page zoom could be useful (hopefully not for a few years for me yet), but wow does it ever slow things down. Zoom in once and try page scrolling… not so fast now.
* I love, love, love the new address bar! If I am going to interface with browser in any way, it’s through the address bar so this improvement is quite welcome. Basically when you start typing in the address bar you are presented with much the same information your were before, but it’s clearly defined in two categories; history and bookmarks. In both cases it presents you with the site title followed by the URL which makes it very easy to get your bearings.
* The search field is now really slick too. It’s along the lines of Inquisitor, offering you suggestions and previous search queries. Very nice!
* CSS Animation, CSS Effects, CSS 3 Web Fonts… just more things to tease us web developers with. Stuff we won’t be able to use in the real world until all other browsers catch up. We can always dream though…
Overall, I think this is two things combined; a promising look at where web browsers should be and a sobering reminder of how much waiting for other browsers to get there will suck.

