Showing posts with label OSX. Show all posts
Showing posts with label OSX. Show all posts

Tuesday, July 28, 2015

X-Commit-Powered-By "Header"

Just wrote this commit-msg hook for git that just has me looking forward to each commit to the project.  It's only for OSX and its sole purpose is to add a tag that looks like a custom HTTP header which shows what song was playing when the user created the commit.  It only works with iTunes and can handle when iTunes is paused.

Here's an example of how it looks:
X-Commit-Powered-By: Cake - Short Skirt / Long Jacket
 When it detects that your iTunes is paused, it outputs this instead:
X-Commit-Powered-By: Silent Meditation
 You can change all this, of course, with a little bash-fu.

Without further ado, here's the script.  Move it to your git repository's .git/hooks directory and rename it to "commit-msg".  Throw in a chmod +x .git/hook/commit-msg and you're good to go!  If you already have a commit-msg hook, you can add this snippet to the end of it (minus the hash-bang line)

#!/bin/sh
# Adds the currently playing iTunes track to the commit message

# Add a blank line
echo >> $1

state=`osascript -e 'tell application "iTunes" to player state as string'`;
if [ $state = "playing" ]; then
    artist=`osascript -e 'tell application "iTunes" to artist of current track as string'`;
    track=`osascript -e 'tell application "iTunes" to name of current track as string'`;
    echo "X-Commit-Powered-By: $artist - $track" >> $1;
else
    echo "X-Commit-Powered-By: Silent Meditation" >> $1;
fi

 Happy committing!

Tuesday, December 29, 2009

CheckPoint VPN-1 SecureClient on Snow Leopard

It turns out that the CheckPoint VPN-1 SecureClient for Leopard (OSX 10.5) doesn't work on Snow Leopard (OSX 10.6) due to differences between the two versions in the kernel and the way kextload works.Harald has a blog entry detailing how to fix the Leopard package so it installs on Snow Leopard and then fix the installed files so they properly run as well.  He alludes to a method to fix the package itself so you can install it on multiple Macs without manually making those changes.

I took it upon myself to modify the package and am providing it here.  Feel free to use it at your own risk.  You can verify the authenticity of the file by running the following command to get its checksum:

cksum SecureClient-VPN-1.zip


You should get the following output:


3505974925 22321216 SecureClient-VPN-1.zip

Tuesday, December 15, 2009

OSX and /etc/resolv.conf

I recently went back to a Mac laptop and encountered an interesting issue.  I needed to make some changes to /etc/resolv.conf to reflect a modified search path and since /etc/resolv.conf is a symlink to /private/etc/resolv.conf I edited the latter file.  All was well until I connected to a different network.  Now my /private/etc/resolv.conf file, which clearly states that it's an auto-generated file, wasn't updated resulting in the "host" command (among other things) breaking.  After posting on Apple's forums I ended up answering my own question.

/private/etc/resolv.conf is itself a symlink to /var/run/resolv.conf which is the file that is auto-generated.  I ended up discovering that after looking at the /private/etc/resolv.conf file in my oldest Time Machine backup.  That'll learn me.