knife cookbook site install fails

I assume due to very old, previously installed vendor branches. Do the following:

Cancel the merge the failed command put you into:
git reset --hard HEAD

Delete the problematic vendor branch:
git branch -D chef-vendor-

ATTENTION make sure you did not modify the vendor branch yourself - you'll lose those changes!!!

Switch between spec and source in Sublime Text 2

Install the RubyTest Package

Then you can use

CMD + .

to switch between the spec and the rb file.

Delete a remote branch with git

Delete the local branch

git branch -d branch_to_delete

Delete the remote branch:

git push origin :branch_to_delete

NOTE Make sure you put the colon in front of the branch name

Thanks, @nistude

Sublime Text 2 on the OS X Command Line

To use Sublime Text 2 as command line editor, you need to create a symlink:

If installed via Homebrew Cask:

ln -s "/opt/homebrew-cask/Caskroom/sublime-text/2.0.1/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl

or, if installed manually:

ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl

And if you want to use it as your default editor e.g. for git status messages, set your EDITOR environment variable like this:

vi .bashrc

export EDITOR='subl -w'

Install ffmpeg with homebrew on OSX 10.7

brew install --use-clang ffmpeg

Display time of file

$ brew install coreutils
$ gdate -r file.ext '+%F %T'

Will print:

2007-06-27 20:03:44

Change Time Format when using ls on Mac OSX

If you want to display the timestamp of a file e.g. in ISO format when using ls on OSX, then you need to install the coreutils e.g. using homebrew

$ brew install coreutils

Then you can use

$ gls -l --time-style=long-iso

to display something like this:

-rwxrw-rw- 1 root wheel 433440000 2007-06-27 20:03 Clip 01.dv

ls -l produces:

-rwxrw-rw-  1 root  wheel  433440000 27 Jun  2007 Clip 01.dv

Ext3 on Mac OSX Lion

To be able to read ext3 formatted disks on Mac OSX Lion (10.7) you need to install a current FUSE implementation (macFUSE is discontinued, but there are several newer projects):

Then, you need to install the filesystem itself. The fuse-ext2 is just right (and supports ext3 as well):

fuse-ext2

After installing both packages you should be able to plug-in a ext3 formatted linux disk and it should show up in your...

Enable Versioning on Amazon S3 bucket using ruby

If you want to enable versioning support for an Amazon S3 bucket, you can use the fog gem.

$ gem install fog
$ irb
irb> require 'fog'
irb> storage = Fog::Storage.new({:provider => 'AWS', :aws_access_key_id => ACCESS_KEY_ID, :aws_secret_access_key => SECRET_ACCESS_KEY})
irb> storage.put_bucket_versioning("your bucket name", "Enabled")

To find out the status of your bucket versioning (can be NIL, if versioning was never used on the bucket, "Enabled" if versioning is currently used, and "Suspended" if versioning was us...

Save file in vi using sudo

If you edit a file with vi as normal user, but need superuser rights to save it, you can use this sequence to save it using sudo:

:w !sudo tee %

/hat tip to @nistude