Easier vHost setup

Starting development on a new web project is a pretty mundane task: Probably cloning some existent repository or creating the initial folder structure and then setting up a local virtual host, so each project got it’s own development domain, like fancyproject.dev.

Especially the last part is quite annoying: Manually editing the hosts-file and adding a new vHost in the Apache config files.

After years of just going with this workflow, I found a way to cut this whole process. Using dnsmasq and wildcards in the Apache config do the same thing without having to change a single line of config files.

Raspberry Pi

I often thought about having a Raspberry Pi and doing all kinds of supercool stuff with it. But it took me until last week to actually get one and play with it.

Automatically Sync PhotoStream to Dropbox

The sync behind Apple’s photostream is really comfortable. My photos are uploaded when my iPhone has WiFi and my mac downloads them instantly. So when I want to get an image from my phone I just have to tap into the PhotoStream.

But all regular solutions are in some way inconvenient. To access the PhotoStream you have to use the somewhat bloated iPhoto and Dropbox requires you to either start the iOS app or connect your iPhone via USB. None of these options are really comfortable.

Digging into Photostream

Turns out OS X saves the images as regular files, but puts each in a separate subfolder – not that cool for direct use. But at least that’s automatically done by a system service, so no need for iPhoto.

In a quick Google search I found an AppleScript that copies images from the PhotoStream to the Dropbox folder. That seemed great until I noticed it freezes the Finder for the duration of the sync.

Copying the PhotoStream into your Dropbox

That’s why I came up a little bash script that does the same but it runs faster and doesn’t freeze the Finder. You can find it below or on GitHub Gist.

The script just takes all files starting with IMG_ from the PhotoStream folder and copies them into the subfolder photostream of my Dropbox. Make sure you adjust the second path and make the script executable.

cd ~/Library/Application\ Support/iLifeAssetManagement/assets/sub/
find . -name 'IMG_*' -exec cp -n -p {} /Volumes/HDD/max/Dropbox/photostream \;

Additionally I registered the script as a LaunchAgent, so it automatically gets started every 5 minutes. Again, make sure you adjust the paths and save the .plist-File (is.justcurious.photostreamsync.plist) in ~/Library/LaunchAgents/ . (A restart is required to actually register the LaunchAgent.)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">