Automate Updating Your Git Repositories
I have a half dozen TextMate bundles that I am grabbing the latest versions from GitHub instead of from the main TextMate subversion repository. For a long time I have been updating each of the bundles’ Git repositories by cd’ing into each directory and running git pull. Doing this over and over became silly and I was annoyed from doing all that typing.
Today, I finally wrote a basic bash script that automates updating each of the repositories. Sometimes it is surprising how simple an automated solution turns out to be.
Download all of Jonathan Coulton’s free songs with ease
Jonathan Coulton, the Programmer turned Musician/Internet Superstar is freaking sweet and has several of his songs freely downloadable on his website. However, if you want to download them all it takes a lot of clicking (roughly 100 clicks actually) so I compiled a nice shell script that grabs all 35 free songs using curl.
Two of my favorite Jonathan Coulton songs, Baby Got Back(Sir Mix-a-Lot cover) and Code Monkey are not free to download however at $1 a piece for a DRM free MP3 or FLAC file I will be happily purchasing them from his website as soon as I finish this entry. The other song he made that I really like is the Portal song which plays during the credits after you beat the game.
Anyways grab the script and enjoy some free music. If you like the songs you can easily purchase the rest of his music from his website on a individual song or album basis.
-
Jonathan Coulton Downloader - Released on December 9, 2007.
Quick SCP from inside Finder with Applescript
Because I own both a Macbook and a Linux desktop I frequently need to transfer files to my desktop for my laptop. This is usually a painless process of opening Terminal and typing an SCP command but I wrote a script to automate this process for me.
I use the script by first selecting the files I want to transfer and then invoke Quicksilver run “quickscp”. The script grabs the files I have selected in Finder and SCPes each one to the destination specified in the script. For this to work I first had to setup ssh keys on my desktop so scp can log in without prompting me for my password, this is essential for the transfer process to be seamless.
For non Quicksilver users I also created an Automator workflow which can be saved as a Finder plugin and then invoked by right clicking on the file -> More -> Automator -> ‘name of plugin’.
Before using either script you have to change the destination variable to the ip address or hostname of the computer you want the files to be transfered to.
-
Quick SCP Applescript - For use with Quicksilver. Updated December 6, 2007
-
Quick SCP Automator Workflow - Updated December 6, 2007
Change VLC cache preference with a Finder plugin using Automator
Over on MacOSXHints.com there is a great tip showing how to use Automator to set VLC caching delays. Something like this is great (actually essential) for anyone who watches videos or listens to music over a network share (Samba, NFS, AFP). I do this almost daily and before it was annoying because the video would be very jaggy because VLC was not caching enough of the video ahead of time. The solution to this was to change the following preference in VLC: Input / Codecs -> Access Modules -> File -> (click Advanced) -> Caching value in ms. This is a huge hassle so nclark42 wrote an automator action that changed the preference for you (that is the workflow given on macosxhints). To run that script you must first run either the network workflow or the local workflow depending on where your video is located and then open the video file which is fine but my roommate suggested that it would be nice if you could just open the file in finder and have the script set the correct preference for you.
And thus I cooked up this alternative Automator action. One is scripted in Ruby and the other is done in Applescript. They do the same thing I am just providing both is case anyone has a preference. Each script takes the following actions:
- Check is VLC is running
- If VLC is running close it and sleep for 1 second
- Check the path of the file, if it starts with “/Volumes” then change the caching preference to 5000 ms, otherwise set it to the default 300 ms.
- Sleep for another second.
- Launch VLC and play the video.
According to MaxOSXHints, the pauses are necessary to allow VLC to write out to the vlcrc file before we make our changes. To use the workflow, open it Automator then select File -> Save as Plugin. Make sure Finder plugin is selected and give it a name like “Open in VLC and change cache”. Finally open finder, right click on a video and select More -> Automator -> Open in VLC and change cache.
I wrote the script twice, once using Ruby and once using Applescript. Both do exactly the same thing so just pick one and use it. I am making both available in case someone wants to look at them. I tested the scripts in OS X 10.5 but they should work with 10.4 as well.
-
VLC Cache Modifier - Ruby version. See instructions above. Updated December 6, 2007
-
VLC Cache Modifier 2 - Applescript version. See instructions above. Works exactly the same as the one above. Updated December 6, 2007
