This file contains 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
class String | |
def each_word | |
self.split.each { |value| | |
return value if yield(value) | |
} | |
end | |
end |
This file contains 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
class Array | |
def sum | |
inject(nil) {|sum,x| | |
sum ? sum+x : x | |
} | |
end | |
def mean | |
sum/size | |
end |
This file contains 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
#!/usr/bin/env ruby | |
require 'bloops' | |
b = Bloops.new | |
b.tempo = 100 | |
s1 = b.sound Bloops::SQUARE | |
b.tune s1, "-- 16:C + 16:C - 16:A + 16:A - 16:B + 16:B 2 4 - 16:C + 16:C - 16:A + 16:A - 16:B + 16:B 2 4 - 16:F + 16:F - 16:D + 16:D - 16:E + 16:E 2 4 - 16:F + 16:F - 16:D + 16:D - 16:E + 16:E 2 2 32:E 32:D 32:C# 8:C 8:E 8:D - 8:G# 8:F + 8:C# 32:C 32:F# 32:F 32:E 32:B 32:A 16:G# 16:E - 16:B 16:A# 16:A 16:G#" | |
b.play |
This file contains 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
Bootstrapping Chef on server | |
server knife sudo password: | |
Enter your password: | |
server | |
server | |
0% [Working] | |
server | |
Ign http://security.ubuntu.com precise-security InRelease |
This file contains 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
class Host < Struct.new(:host_name, :use, :address, :max_check_attempts, :check_interval, :retry_interval, :check_period, :contact_groups, :notification_interval, :notification_period, :icon_image, :statusmap_image, :register) | |
def to_s | |
ret = "define host {\n" | |
ret += "\thost_name\t\t#{host_name}\n" | |
ret += "\tuse\t\t\t#{use}\n" | |
ret += "\taddress\t\t\t#{address}\n" | |
ret += "\tmax_check_attempts\t#{max_check_attempts}\n" | |
ret += "\tcheck_interval\t\t#{check_interval}\n" | |
ret += "\tretry_interval\t\t#{retry_interval}\n" | |
ret += "\tcheck_period\t\t#{check_period}\n" |
This file contains 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
def translate(word) | |
@word = word.to_s | |
result = "" | |
if word.scan(/[aeiou]/).count >= 1 | |
result << @word + "ay" | |
end | |
end |
This file contains 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
asd | |
fa | |
sdf | |
asdf |
This file contains 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
require './lib/harddisk' | |
module ReImagEngine | |
class DiskImager | |
attr_reader :harddisks | |
attr_accessor :server_address, | |
:server_shared_type, | |
:server_share_name | |
# config shit here or even extract a config class |
This file contains 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
module Color | |
NC = "\e[0m" | |
WHITE = "\e[1;37m" | |
BLACK = "\e[0;30m" | |
BLUE = "\e[0;34m" | |
LIGHT_BLUE = "\e[1;34m" | |
GREEN = "\e[0;32m" | |
LIGHT_GREEN = "\e[1;32m" | |
CYAN = "\e[0;36m" | |
LIGHT_CYAN = "\e[1;36m" |
This file contains 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
elif [[ "$COMMAND" = -* ]] ; then | |
# class and package names cannot begin with a - | |
echo "Error: No command named \`$COMMAND' was found. Perhaps you meant \`hadoop ${COMMAND#-}'" | |
exit 1 | |
else |
OlderNewer