Skip to content

Categories:

Local/server synchronization via rsync and FSEvent

A lot of the work I do is PHP/html type coding. I try to keep a local setup that is able to run all of my code without too much trouble, but eventually all that code has to be tested on something resembling the production environment, or there are certain functions that can only be performed there (say, handling NFS mounts, or attaching to databases otherwise firewalled on my local machine).

In those situations, I need to be able to quickly copy my code from my local machine to the development server. I used to do this manually, but the cycle of edit-save-copy-test was really annoying. Aptana and Eclipse have some tools that help, but I don’t use those tools anymore day-to-day, and they seemed to always get messed up.

I took while to find a suitable setup for keeping files in sync like this. Somehow I came across doubledown, a ruby script using the OSX FSEvent framework. For whatever reason, I couldn’t quite make it work on my machine (YMMV), so I took the idea and searched for other uses of FSEvent out there. I came across a few rubygems wrapping FSEvent nicely, and wrote a script around that.

First, you’ll probably want to set up ssh keys. This will let you rsync over ssh without having to log in every time (kind of important on this one). I don’t like the idea of having keys that don’t have a password, so I use keychain to manage my keys. In my ~/.bash_profile I have the following snippet:

The random delay lets me launch more than one shell at a time (my default windowgroup in Terminal.app is has two) without conflict.

Second, you’ll want to have a way to fully-sync your directories. The following script does this with a single command, and with some options provided by gnu getopt. The biggest features are a preset source/destination (which can be appended), and skipping .svn/.hg directories. In a rush, skipping those makes a HUGE speed difference (especially when skipping svn).

Now for the actual ruby script using FSEvent. It also includes using growl to notify on synchronization events. While not required, it is nice to know when things are synched (and it lets me know the script is still running), but it can get a bit spammy (especially running svn up on a directory).

These scripts aren’t perfect, and are meant to be modified to your own needs and preferences. Its so nice not to have to worry about manually syncing the directories anymore though!

Posted in Coding.


Using Bitbucket for gist-like snips

So, in an effort to start updating my blog more often, I plan on posting more code – some C#, Objective-C, PHP, whatever I happen to be working on or find useful. I’ve got a bit of a backlog of these things, and I’m happy to share them.

One of the issues I had was I wanted to use Bitbucket to manage snips. Gist is great, but all my other stuff is on bitbucket, so I’d rather be able to post snips there, but they don’t have a pastbin/gist like service.

So to get around it, I’m using a repo and bitbucket’s ‘embed’ code. Its a slight bit more work, but I think with a WordPress plugin or even just a simple bookmarklet, I can make it pretty painless.

Example:

I’ll work on the styling for this, but it seems to work just right! I can even attach it to tags or revisions as needed. More to come on any tools I build for this!

Posted in Coding.


A Little History: AC2 100 Days Review

One of my better reviews from the old days of GameWatchers was the AC2 100 Days Review.  Since it looks like I have no version of this online anymore, and even archive.org refuses to bring up archives of gamewatchers.net past, I’m reposting it here.  It was originally published around the beginning of March, 2003.  Its a fun look into a game I really enjoyed.

I plan on doing a similar style review for Warhammer Online soon.

Continued…

Posted in Games.

Tagged with , .


Blog Reboot

Reboot

Though I’m probably keeping all the old articles (including the junk Quickyfeed posts), I’m trying for a Blog Reboot here.

The idea is to actually start posting to the blog about things I’m doing, playing, or watching; or about actual topics!  Amazing that!  I’ve already got a few ideas cooking about things I’ve been working on, so unless I really lose The Drive, I’ll be posting somewhat more regularly.

If you’ve ever seen the blog before, you will probably notice a new theme – Pixeled – which I’ll probably tweak a bit later.  I haven’t tried it in a great many browsers so if you run into issues let me know.  I also switched to IntenseDebate for commenting because they totally rock!

If you’re new to the blog, either through FriendFeed/Twitter or some other site, welcome and enjoy the stay.  If you never noticed that FriendFeed widget on the right – that’s mostly replaced my short one-off posts and the ‘QuickyFeed’ posts since its so easy to post quick stuff there.

So yeah, we’ll see how it goes this time.  This type of post is the typical clichéd ‘OMG I need to post more’ post, in a way, I know, I know.

Posted in Blog.

Tagged with , .


QuickyFeed

Posted in General.


QuickyFeed

Posted in General.