This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| irb(main):001:0> def a; return "a"; end; | |
| irb(main):002:0* "Match".match /#{a}/ | |
| => #<MatchData "a"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| shipment = Shipment.create(:order_id => order.id) #assume we have the order loaded already | |
| shipment = Shipment.find(shipment.id) | |
| shipment.save |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| shipment = Shipment.create(:order_id => order.id) #assume we have the order loaded already | |
| shipment.save #this was actually unnecesary |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| curl http://www.reznor.com/tools/chkrootkit.tar.gz > chkrootkit.tar.gz | |
| if test $(openssl md5 chkrootkit.tar.gz | cut -d" " -f2) == $(curl http://www.reznor.com/tools/chkrootkit.md5 | cut -d" " -f1); | |
| then | |
| tar -xvf chkrootkit.tar.gz | |
| cd chkrootkit-* | |
| sudo ./chkrootkit | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # from the standard library : | |
| require 'rss/1.0' | |
| require 'rss/2.0' | |
| require 'open-uri' | |
| require 'time' | |
| # gem install to_slug if you don't have it already. | |
| require 'to_slug' | |
| source = "" # put your feed url here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| array = [:first,:first,[:second,:second,[:third,:third,[:fourth,:fourth]]]] | |
| def walk(array) | |
| if array.class == Array | |
| array.each do |item| | |
| if item.class == Array | |
| item.each { |i| walk(i) } | |
| else | |
| puts item | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| adduser install | |
| apt install | |
| apt-utils install | |
| aptitude install | |
| base-files install | |
| base-passwd install | |
| bash install | |
| binutils install | |
| bsd-mailx install | |
| bsdmainutils install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| words = 0 | |
| puts "How many words today?" | |
| nwords = gets.chomp.to_i | |
| word_string = "" | |
| todays = File.new("NaNoWriMo" + Time.now.strftime('%b-%d'), "w" ) | |
| while words < nwords do | |
| word_string << gets | |
| words = word_string.scan(/\w+/).length | |
| todays.write(word_string) | |
| end |
NewerOlder