Skip to content

Instantly share code, notes, and snippets.

@xntrik
xntrik / gist:1021373
Created June 12, 2011 09:21
Clear trash smartly
find . -type f -atime +60 -print0 | xargs -0 rm
@xntrik
xntrik / gist:1088638
Created July 18, 2011 05:53
getting rid of pesky carat Ms or ^M characters in vim even after a dos2unix conversion.
:g/^M/s///g
BUT, you can't just write <Shift>+6 for the ^ character, you need to hold down <Ctrl>+VM (or <Ctrl>V <Ctrl>M).
@xntrik
xntrik / gist:1088752
Created July 18, 2011 07:15
ruby regexps explained for dumb asses
http://strugglingwithruby.blogspot.com/2009/05/regular-expressions-in-ruby.html
@xntrik
xntrik / gist:1106534
Created July 26, 2011 11:29
diffing two folders and sub folders
diff -rq dirA dirB
@xntrik
xntrik / gist:1110985
Created July 28, 2011 04:52
change ya MAC in OS X .. god I'm so lazy
sudo ifconfig en1 ether 00:e2:e3:e4:e5:e6
@xntrik
xntrik / gist:1126986
Created August 5, 2011 05:57
ruby string to datetime formatting strings
http://www.ruby-doc.org/core/classes/Time.html#M000392
@xntrik
xntrik / gist:1155950
Created August 19, 2011 03:20
rake aborting
If you're using rvm and multiple rubies and rails etc and rake borks on you.
Execute it with "bundle"
ie. bundle exec rake -T
or
bundle exec rake db:create
from: http://house9.blogspot.com/2011/06/rails-31-and-ruby-192-p180-rake-aborted.html
@xntrik
xntrik / gist:1333024
Created November 2, 2011 06:19
supress crazy irb output
by putting ;nil on the end.
@xntrik
xntrik / gist:1359842
Created November 12, 2011 01:11
Smarter ruby method overloading using alias_method
http://www.leonardoborges.com/writings/2008/08/07/why-i-like-ruby-1-alias_method/
module ActiveRecord
class Base
alias_method :find_with_ferret_original, :find_with_ferret
def find_with_ferret(q, options = {}, find_options = {})
remove_diatrictics!(q)
find_with_ferret_original(q, options, find_options)
end
@xntrik
xntrik / gist:1378522
Created November 19, 2011 06:18
Metasploit on git, C Perez' article on PDC
http://pauldotcom.com/2011/11/metasploit-changes-to-git.html