Operating System Checks in Bash

I have been using my Mac and Linux computers a lot more recently. Syncing configurations between the two machines is pretty easy with tools like JungleDisk or Dropbox. Today I just started syncing my .bashrc and .bash_profile between the two systems. There are some configurations that need to be different on a per machine basis however. I wrote this quick little bash script to illustrate an easy way to do this. Pretty trivial but useful nonetheless.

OS=`uname`
 
if [ "$OS" = "Darwin" ]; then
  echo "Running on Mac"
else
  echo "Running on Linux"
fi

Also, uname -n will return the computer name if you want to check that as well.

How to create the perfect home office – Part 2 – The equipment and software

After you get your furniture right, the next step is setting up all your equipment. For me, my desk revolves around three computers. My desktop which is really just there in case I get the urge to game. My Mac for pretty much everything non-work related. And my work laptop.

The Hardware

There are only two things that matter to me with hardware. Number of wires and awesomeness. I am not going to go into too much depth regarding my hardware decisions, just a couple of pointers that helped make my home office sweet.

For the computer decision, go with laptops or all-in-ones for all non gaming activities. Desktops should only be needed if you need ultimate performance. If you want to read about my MacBook Pro, I have already posted a good amount on it. I highly recommend it.

The Epson Workforce 610 is a great printer to add to your home office. It is an all-in-one that works on Mac and Windows and only requires a power cord. The wireless on it is easy to setup and I haven’t had a single problem out of it. (It is important to note I print maybe 2 pages a week and scan 1 page a month. I am not a power printer user, so I can’t speak to how it holds up under heavy load).

The other key piece of hardware for an office is wireless routers. I highly recommend buying variants of the Linksys WRT54G. With a quick firmware upgrade to DD-WRT you have a whole slew of networking options at your fingertips.

The Software

What I bet you didn’t realize was how important software is in your home office. Software can replace hardware and wires. How you ask?

Synergy is a software KVM (it is actually much more than that but for the purposes of your home office, it makes having multiple computers a breeze). Now you don’t need multiple keyboards or KVM’s with ridiculous amounts of wires going everywhere.

If you have an external hard-drive, I have news for you: you don’t need it anymore! Jungle Disk + Cloud Files gives you cheap, unlimited storage. Yes I work for Rackspace, but I was a Jungle Disk customer long before they joined our team. I have had hard drive failures, multiple reformats and numerous computers. Jungle Disk has helped me through it all.

Future improvements

Even though I claimed my home office is perfect, which it is, it has some improvements I want to make.

Connect360 helps share media between your Mac and XBox 360. Windows supports sharing with an XBox 360 out of the box, but it is lacking on a Mac without this piece of software.

The speakers I have are 10 years old (which doesn’t bother me) but it has 7 wires for 6 different pieces of equipment. Too much. I’m thinking the Klipsch ProMedia 2.1 Wireless Speakers are the way to go. There are only 3 wires (none going into your computer) and 4 components.

My keyboard is wired. Not a big deal, but one less wire is always nice. I like the Logitech Unifying system but I might just go with the Mac periphials. (I want somthing a little ergnomic but finding a cool ergo keyboard is pretty hard).

Setting up your Mac for .NET development

Last night I spent a few hours getting my Windows virtualization setup so I could use Visual Studio from the Mac. It ended up being way cooler and easier than I thought. All it requires is two simple things, Parallels and mklink.

Parallels

I was hesitant about paying $79 for virtualization software when other software like VirtualBox is completely free. My advice, try the free trial of Parallels and you will understand why it is worth the price.

It allows you to create shortcuts to Windows apps in the Mac Dock.

Integrates the Windows task bar with the Mac menu bar.

Putting it all together, you get to run Windows apps right beside Mac apps in what Parallels calls Coherence mode.

Some other notable features are:

  • Integration with Bootcamp partition
  • Integration with Windows start meu
  • Much more…

The overall performance is good. I noticed some slowness when dragging windows around, but for everyday usage, it runs great. There are some oddities of using Parallels in Coherence mode, but no deal breakers. I definitely recommend it because of the low overhead in context switching between Mac and Windows applications.

mklink

Even with Parallels, Windows runs on a different filesystem than the Mac. It does offer shared profiles, but I only wanted to share my Visual Studio project files.

mklink is a tool I had never used until last night. For those of you familiar with Linux, it is simliar to the ln command. Here is how I used it.

mklink /d "c:\Users\Brian\Documents\Visual Studio 2008\Projects" \\.psf\Home\Documents\Projects

What this simple command will do is create a symbolic to my Mac home folder for all Visual Studio projects. From Windows, it works like a normal folder.

Now, I can easily code side by side in TextMate and Visual Studio straight from OSX.

Zero to Synergy+ in 5 minutes

Synergy+ is most easily described as a software KVM. In reality, it is much more than that. It is more like having multiple monitors, except each monitor is actually attached to its own computer. Synergy+ is a fork of the original project, which hasn’t been updated since 2006.

Enough with the chit-chat, lets get it up and running on Windows in no time.

Install

Install – Done.

Configure – Server side

This is the confusing part. I will take you through the GUI, which doesn’t exist for the Mac or Linux as far as I could tell.

Start Synergy and select the Share this computer’s keyboard and mouse (server) option. Then click Configure.

From there, the next step is adding the screens, which represent the different computers you want connected. Click the + to get going.

First, enter your local computer information. Seems weird that it didn’t add it by default, but it doesn’t. Basically, all you need to enter is your computers name (which can be found/changed on the Synergy Info button on the main configuration screen).

Next, enter in the client computer’s names that you will be connecting.

From there you need to create links. Links tell Synergy how one screen should be linked to another (seems obvious huh). In our example we have two screens, so we need two links. One link will connect Screen 1 to Screen 2, while the other does the reverse.

Configuring the link is a mind trip, so much so that I can’t even describe how to do it. I suggest ignoring the size percentages, and create a sentence like left of Screen 1 of Screen 2. Then click +. After this, it becomes more obvious what you did (just trust me please).

Then the reverse.

Now just Start the server and your server config is basically done.

Configure – Client

The client really doesn’t require any configuration. Just select the Use another computer’s keyboard and mouse (client) option, then enter the server name and click Start

And now for my super sweet home-made video.

Next Steps

Read through the Synergy wiki, which will help you on more complicated setups on Mac and Linux.

I also noticed a couple things that didn’t work too well.

  • Mouse is sometimes laggy – I think this may be because my server is actually my oldest computer. The lagginess isn’t bad enough for me to not use it however.
  • Print Screen didn’t work too well, which made the capturing of the above screen shots a little cumbersome
  • If your computer locks automatically after a certain time and it isn’t the server, synergy can’t be used to unlock it.

My Home Mac Setup

Ok, here is a list of software I have installed. It is a pretty good list for only a few days with the machine. Note this is for home, not for work. Otherwise the list would be way different.

  • Eclipse – Android and Java tinkering
  • Firefox – To test, not to use.
  • Chrome – Best browser out there, I promise!
  • JungleDisk Desktop – Backups and synchronization are a must for any computer.
  • Skype – To see people far away in real time.
  • Adium – To chat to people far away or across the room, while also being able to ignore them.
  • CoRD – I still need to get on Windows boxes.
  • Quicksilver – App launchers are my hidden productivity tools.
  • Growl – Makes Adium have cool sounds I guess.
  • TextMate – The most recommended Mac editor. Not sold yet, vim is the bomb.
  • Open Office – Because it is free, and good enough (maybe?)
  • Tweetie – My new favorite twitter client. Warning, not for twitteraholics, but for casual users like myself.
  • Git – Git is a MUST if you develop software. Even if your team uses SVN, you can still use git and should!
  • MySQL – You always need a database on hand.
  • RVM – Nifty way to manage multiple Ruby versions.
  • Virtual Box – Because you still might need to run a little Windows stuff here and there.
  • CyberDuck – Move files all over the place.
  • Windows 7 on Bootcamp – Just in case :)

Whew!