Skip to content

Instantly share code, notes, and snippets.

View panaggio's full-sized avatar

Ricardo Panaggio panaggio

View GitHub Profile

Remove trailing whitespace, convert tabs to spaces and file format to unix (remove ugly ^M carriage returns) from files using a single command:

vim -es -c 'set et ts=2 | bufdo retab | %s/\s\+$//e | set ff=unix | w' -c 'q' FILES

You could get your FILES using find

vim -es -c 'set et ts=2 | bufdo retab | %s/\s\+$//e | set ff=unix | w' -c 'q' $(find scripts -name '*.sh' -type f)

If in doubt, ask man.

@fnando
fnando / rubygems_proxy.rb
Created April 28, 2011 22:54
Rack app for caching RubyGems files. Very useful in our build server that sometimes fails due to our network or rubygems.org timeout.
# Moved to its own repo: http://github.com/fnando/rubygems_proxy