sqldump

(coffee) => code

Hidden VNC Client in OS X

Useful alias to add to your .zshrc or .bashrc or .profile or whatever.

1
2
# VNC
alias vnc="/System/Library/CoreServices/Screen\ Sharing.app/Contents/MacOS/Screen\ Sharing"

Vim Won’t Let You Paste Properly?

When you paste in vim, if the indents look funny, then before you paste, run:

1
:set paste

make sure you’re in insert mode, do paste, then

1
:set nopaste

and continue editing.

Git, Tags and GitHub

Add a tag:

1
git tag -a v0.1 -m "Version 0.1 Stable"

Push tags to GitHub:

1
git push origin --tags

Delete tag locally:

1
git tag -d v0.1

Push to GitHub:

1
git push origin --tags

Rinse.

Repeat.

Vagrant on Ubuntu

Getting vagrant installed on ubuntu isn’t as easy as it should be (as of v1.0.5 on 12.10). Here are a few solutions to make your life easier:

Bug 1:
I noticed that ruby + gems didn’t exist on a vanilla 12.10 install and that installing the official .deb from vagrantup.com resulted in a vagrant not found error.

Fix 1:

1
2
sudo apt-get install ruby1.8 ruby1.8-dev rubygems1.8 virtualbox-ose
sudo gem install vagrant

Bug 2:
After running my first vagrant up with a precise64 base box, I noticed that the guest VM was having trouble with resolving domain names. Peeking at the /etc/hosts file, I saw an entry that read:127.0.1.1 precise64 After correcting this to 127.0.0.1 precise64, it still froze when pip installing some python modules. This was strange considering the guest was configured to run in bridge mode.

Fix 2: The following settings cured it:

1
2
VBoxManage modifyvm "myvagrantbox_23901293" --natdnshostresolver1 on
VBoxManage modifyvm "myvagrantbox_23901293" --natdnsproxy1 on

Here, myvagrantbox_23901293 is the name assigned to the guest in virtualbox by vagrant and can be found via the virtualbox UI.

ISO Date-time String to DateTime in Java

This requires Joda-Time.

Check Out and Track Remote Branch From GitHub

For those times when you need to checkout a branch locally and set it up to track a remote branch that already exists on GitHub:

1
git checkout -t origin/myremotebranch