Quicksilver trigger: open with Textmate

September 20, 2007

Just made my best trigger yet! For those not in the know, quicksilver can be used to create custom short-cuts that do something when you press a certain key combination.

I had already made a open Gmail trigger, so I can open Gmail just as simple as command+option+g. This ones pretty nice, but the one I did today combines my favorite Mac app (Quicksilver) with my favorite Mac editor (Textmate).

One nice feature of Textmate is its ability to open folders and display their contents on a side drawer. The part that always bothered me was getting to the right folder while in Textmate. I usually had it opened in the Finder, but then would have to re-navigate to it when I wanted to edit files in the folder.

But No More!

For this trigger I turned on the proxy objects in the Quicksilver section of the Catalog.

proxy-on.png

This Gives you access to the ‘Current Selection’ proxy object, which represents what you have highlighted at any given time. Folders, files, whatever. It’s a very useful proxy.

Now we are able to create a trigger that opens the Current Selection (i.e. a folder) in Textmate.

Quicksilver textmate trigger

Assign this to your keychord of choice (I picked command+option+m but I don’t know if thats a good one) and you’re ready to use Textmate, via Quicksilver, all the more efficiently.

Update:

I found a problem with the key combination I choose, namely option+command+m is used to highlight text in the best pdf viewer / editor : Skim. So, what to do? I don’t like having three modifier keys as part of the key combination, so I didn’t really want to move to control+option+command+m.

So I took advantage of another Quicksilver feature that lets you limit where your triggers are used. If you open the information pane for your trigger, and select the ‘Scope’ tab, you can set limits or exceptions to the validity of your trigger.

scope.png

I could have also just disabled it in Skim, but so far I can’t think of another place this would be useful except in the Finder…

Btw: You just type the name of the program you want to limit the scope to – so type it right.


OpenVPN Server on Mac

September 26, 2006

Spurred by a unhelpful digg post on setting up an OpenVPN server on Windows, I decided to finally get OpenVPN working on my Mac, which is currently running as my web server / other servers. I eventually found some help, but it took awhile, so why not gather it all up here.

What is OpenVPN?

A VPN or Virtual Private Network essentially connects a remote machine to a network, over the Internet, securely. A common use for VPN is to let a user at home or on the road make an encrypted connection to his office’s network as if he/she were actually in the office. In this type of setup, you would be able to connect to file servers, mail servers, or printers remotely, without having to worry about someone on the Internet watching what you do and snagging private information.

I wanted to use it so I could use VNC to connect to some of my home machines on my laptop at school.

OpenVPN utilizes SSL, the same technology used to encrypt websites to make its connection secure. Its also OpenSource and free, which are two good reasons for using it. It is also fast and very powerful, once you get things set up.

One alternative to OpenVPN commonly cited is Hamachi. It seems easier to set up and can run on the major 3 OS platforms. The main reason I shyed away from Hamachi, as many people do, is because it is closed source, and owned by a company. That means you just really can’t be sure about what its doing or how its doing it. Sometimes this is acceptable, like when using Skype, but sometimes, you’d just rather have the open software. Plus, OpenVPN is a much cooler thing to have running on your system anyways.

Configuring The Server

This was where there isn’t a lot of Mac specific info. Most tutorials deal with using Linux or Windows. Thats fine, probably what most people have as servers. But I wanted it on a Mac! The ever useful Darwinports has a port of OpenVPN, labelled “openvpn2”. They have the regular openvpn port, but it is an older (1.6) version, and that won’t due.
Install it by using the command

sudo port install openvpn2

This will get you most of the packages you need to get things going.

Now we turn to the OpenVPN site for configuration instructions. You can follow the Linux instructions pretty closely, and things will work out well with a few exceptions:

  • The easy-rsa folder can be found at /opt/local/share/doc/openvpn2/easy-rsa . I copied the openvpn2 folder to someplace easier to find like /opt/local/etc/openvpn . You could make it easier and put it in /etc/openvpn too, but sometimes I forget to check there…
  • The sample server and client configuration files can be found at /opt/local/share/doc/openvpn2/sample-config-files. I also grabbed the server.conf file and copied it to my simplier openvpn folder. Making these copies will also ensure your changes won’t be overwritten when OpenVPN is updated.
  • according to this hint from macosxhints.com,tunnelblick might be needed to get OpenVPN working correctly. Download tunnelblick here,the current version I got was 3.0 RC3. We will be using it as our client as well, so more info in that section below

So with the help of the OpenVPN manual and the nice tip about tunnelblick, we should have a working version of OpenVPN on our server.

Configuring the Client

Like I mentioned, we need tunnelblick to connect to our server. Tunnelblick is a very elegant and easy to manage GUI front end to OpenVPN. The 3.0 RC3 version comes with everything bundled together, and all you need to do is drop it into your Applications folder.
Run it and you should see a little tunnel in the upper-right hand corner of your screen.
It should also add the folder ~/Library/OpenVPN. In this folder I copied the ca.crt, client.crt, client.csr, and client.key which were created on the server during the PKI section of the tutorial. I used fugu to move stuff over from the server.
Now you can click on the tunnelblick tunnel icon and then click on “details” to get to the meat of the program. Select “edit configuration” to modify the important stuff. I basically copied OpenVPN’s sample client configuration, and pasted it into here. Modifying the destination IP address and the location of the crt and key files. I had to use the entire path file to get these to work correctly for some reason, namely:
/Users/username/Library/openvpn/ca.crt . I don’t know why I couldn’t use realitive file names, but it wasn’t having it.
Also, I started by using the local IP address of my server to make sure things were working correctly before trying to connect to it from the Internet.
When that was all finished, I selected “Connect” and you should be connected to your own VPN server!

If you have file sharing turned on, you can check your connection by hitting apple + k to go to the connection dialog and connecting to afp://10.8.0.1 (if you followed the tutorial exactly, else use the IP address you set it up for). This should connect to your server.

The next step is to get more machines from your intranet on the vpn. But that is for another post, as I haven’t quite figured it out yet…


Automatic Network Photo Transfer

August 1, 2006

picture-2.pngThe last part of my photo management project was to have an easy way to move images into Picasa. While we will use the Ubuntu box to view and edit pictures, most of our time is spent on our Macs. So there will be times when we have a folder of pictures on a Mac, and want to get that to Picasa as easily as possible.

I used Automator to create a stand alone application that should accomplish just that. First I needed a way to connect to the Ubuntu box. In Automator there is the option to connect to a server, but you have to make sure that that particular folder was shared and enter a password and bla bla bla… too much. Since I had passwordless entry through ssh set up already, why not leverage that to get to the Ubuntu machine?

With a little searching I found an upload with scp Automator action. Perfect! scp is an extenstion of ssh, and this Automator action takes care of moving the folder over too. To use it in Automator, I went to ~/Library/ and created the folder “Automator” then moved the .action file to this folder. When you restart Automator, the upload with scp action will be there. So the Automator workflow first uses “Ask for Finder Items” to select a folder and then “Upload with scp” to copy it to the correct directory on the Ubuntu machine. I have it set up to copy the folder into the “My Pictures” folder inside “PicasaDocuments”. That way, Picasa will automatically add the folder to its listing. It’s so easy!

I then saved the workflow as an application called “PhotoDrag”. Now when I want to copy a folder of pictures over to Picasa, I simply ctrl + space to open QuickSilver, type “phtod” to open PhotoDrag, select the folder, and thats it. PhotoDrag will use scp to move it over to Picasa, and Picasa will automatically add it to itself.

In order to use PhotoDrag on other Macs, you have to grab the scp .action file as well and put it in that ~/Library/Automator folder.

As an aside, I used Mikon to quickly / freely / easily change the ugly default Automator icon into something more relevant.


Picture Backup with Rsync

July 30, 2006

snapshot6.pngUtilizing the Rsync setup I created earlier to backup the Documents folders of our laptops, I came up with a method to backup my newly organized picture collection.

The situation is as follows: My Ubuntu machine keeps the working copy of my photo collection and I would like to back up all the pictures as often as possible to the G3 PowerMac, which has an extra hard drive and is on all the time (its the webserver, printserver, MySQL server, etc).

To accomplish this, I set up passwordless authentication between these two machines, like in the other Rsync setup and then used this shell script on the Ubuntu box to get things moving:

#!/bin/sh
rsync -e “ssh” -rca –delete-after ~/PicasaDocuments/ username@192.168.1.x:/Volumes/back/pictureBackup -vv

/bin/date > ~/backup_script/log.txt

There’s not much difference between this and the previous shell script. This will build a list of the folders / files in the PicassaDocuments folder on my Ubuntu machine, and then match that list on the extra hard drive in the PowerMac (/Volumes/ is the location of all the mounted drives). the “–delete-after” means that if an item was deleted in the original folder, it will be deleted in the backed-up folder as well (not delete the originals after backing-up, like I feared it meant).

After this completes, it should write the date to log.txt in my home directory on the Ubuntu box.

Since both of these machines will be on most of the time, I decided to add this script to Cron to get it working every night. I used KCron (shown above), the KDE GUI to Crontab. Gnome has a Crontab editor too. I set it up to run this script every night at 11:15. After the initial backup of all the pictures, the process seems to run in 5 – 10 minutes. Its a bit taxing to the Ubuntu system, but it can handle it when nothing else is going on.

So with this system, I keep two copies of all my pictures on two different hard-drives. Not a bad deal.


Gmail as a Recipe Organizer

July 26, 2006

logo1.pngMy wonderful wife (of 13 months and one day, today) has come up with the brilliant idea to use a Gmail account to save recipes she finds online.

She had been using Yum, but got frustrated with trying to format the recipe correctly and stopped using it. It would try to be smart and convert the ingredient measurements to standard abbreviations, but usually didn’t get it right, and just made more work for her.

Now with her Gmail Recipe Book, she can log in, copy and paste the recipe and send it to herself. Auto-magically she has the recipe saved for future cooking.

But with Gmails tagging system, she can organize her recipes into categories like ‘chicken’ or ‘beef’. Since you can add multiple tags to an email, she can put recipes into different sections.

In the future, she could create two tags: ‘eaten’ and ‘uneaten’ to further differentiate from those recipes she has tried, and those yet to come.

She also came up with a good rating system. After trying a recipe, she can reply to that recipe and input our thoughts in the reply. That way each time she looks at that recipe, she can see all the replies (reviews) that go with it. Perfect! And if she wants a visual cue to the ratings, we could always use one of the alt symbols: ◊,†,•,‡ etc.


Control Your Subversion: Tips for Setting up Subversion on the Mac

July 4, 2006

subversion_logo_hor-468x64.pngThis is just a little post to help me remember how I got this stuff working.

Subversion is a revision control system that is being developed to replace older similar systems. Revision control lets you update your projects in an iterative fashion and allows you to keep track of these changes. This is perfect for when you have a bunch of people working on the same thing and want an easy way that everyone can work on the same stuff without stepping on other peoples toes.

I have used version control systems on a Java application we developed as a team last semester, and I plan on using it soon to develop web applications, but it really could be used for almost anything: a big proposal, documents for a conference, anything that you might work on in a step-wise fashion.

Plus, it doesn’t have to be a group project to use Subversion. You can use it as an easy backup system so you can work on your stuff from any machine and use it in case you want to revert to an earlier version of something.

They have a free book about how to use / setup Subversion, and there is a lot of info out there on how to use it.

Client

If you have the server set up, using a client to check-in and check-out projects is easy. For Windows there is a client called tortoisesvn that comes highly recommended. I guess it integrates with Windows Explorer to make things easy. For Mac you can use a precompiled command-line version (this one is the most popular and put out by Martin Ott of SubEthaEdit fame) or search for a GUI version. My favorite so far has been ZigVersion. SvnX is also recommended, but froze up when trying to connect to my server (probably because I was initially typing the location wrong).

Server

This is the tricky part. The easiest way to install it on a Mac that I’ve found is using Darwinports and this tutorial. I followed it excatly without any issues. Darwinports is so handy, everyone should have it installed by now. Then I used this section of the book to add basic authentication to my Subversion repository.

New Repository
Now to add a new repository I simply use:

sudo mkdir reposName

sudo svnadmin create –fs-type fsfs reposName

make template and import

cd ~

mkdir svn-template

cd svn-template

mkdir trunk branches tags

Import your template directory into the “reposName” repository using

svn import .http://localhost/svnrepo/reposName -m “Initial import.”

And you should be ready to go. Here’s a list of commands from the book commonly used in messing with the repository:

 

  • Update your working copy

     

    • svn update
  • Make changes

     

    • svn add
    • svn delete
    • svn copy
    • svn move
  • Examine your changes

     

    • svn status
    • svn diff
    • svn revert
  • Merge others’ changes into your working copy

     

    • svn update
    • svn resolved
  • Commit your changes

     

    • svn commit

So that brings together most of what you would need to set up a Subversion server on a Mac, and mess with it. Hope this can help somebody


Symbols say Something

April 8, 2006

SymbolsI really enjoy having folders on my Bookmark-Toolbar in Firefox. They allow me to group sites with similar themes, or sites I usually check at the same time.

But The toolbar can quickly fill up with wordy descriptions, and there's nothing worse than a filled Firefox toolbar. That's why I've started using symbols as indicators for what lies beneath. In the picture you can see my symbols for sites that change often (delta), security sites (squiggly S) and torrents ( the cross being fed with arrows). This way I associate the cool symbols with the actual things they represent (and I think it looks cool too).

To get these symbols, the alt / option key is your friend. Recently a friend of mine was happy to find out that the é symbol could be easily created using the alt+e, e combinition.

If you have trouble remembering whats underneath your standard keys Quicksilver can help. Simply start it up and start typing "Keyboard". It should come up with the "show keyboard viewer" application. This shows you what you are typing now and what are the possibilities from the various function keys.

This is a great little feature that I believe is built into the OS but Quicksilver makes it trivial to access. I plan on using this function to demonstrate different keyboard short-cuts to people in the future.