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 Cube | |
attr_accessor :sides | |
ALLOWED_COLORS = %i[red green yellow blue].sort.freeze | |
def initialize(sides) | |
@sides = sides | |
end | |
def rotate! |
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 log(message, level: :info) | |
message.split("\n").each { |line| logger(level, line) } | |
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
tenant.rb | |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
class Tenant | |
attr_reader :nickname, :occupation | |
attr_writer :nickname, :occupation | |
def initialize f_name, l_name, born_on, gender | |
@f_name = f_name | |
@l_name = l_name | |
@born_on = born_on |
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
tab_count = 0 | |
File.readlines('/path/to/file').each do |line| | |
# The regexp looks for 1 or more tabs at the beginning of the line as a group. | |
# We then split the result by character, then get the size of the Array from the split. | |
# Only do all that if the line matches the regexp in the first place. | |
tab_count += line.match(/^([\t]+)/)[1].split('').size if line.match /^([\t]+)/ | |
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
{ | |
"rabbitmq": { | |
"port": 5671, | |
"host": "sensu-rabbitmq-elb.domain.tld", | |
"user": "sensumq", | |
"password": "SomeSecretP4ssw0rd%", | |
"vhost": "/sensu", | |
"reconnect_on_error": true, | |
"prefetch": 1, | |
"ssl": { |
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 | |
class Connection | |
include Comparable | |
attr_reader :node | |
attr_accessor :metric | |
def initialize(node, metric) | |
@node = node | |
@metric = metric |
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
set groups knuedge-default-applications applications application knu-ftp application-protocol ftp | |
set groups knuedge-default-applications applications application knu-ftp protocol tcp | |
set groups knuedge-default-applications applications application knu-ftp destination-port 21 | |
set groups knuedge-default-applications applications application knu-tftp application-protocol tftp | |
set groups knuedge-default-applications applications application knu-tftp protocol udp | |
set groups knuedge-default-applications applications application knu-tftp destination-port 69 | |
set groups knuedge-default-applications applications application knu-rtsp application-protocol rtsp | |
set groups knuedge-default-applications applications application knu-rtsp protocol tcp | |
set groups knuedge-default-applications applications application knu-rtsp destination-port 554 | |
set groups knuedge-default-applications applications application knu-netbios-session protocol tcp |
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
stop() { | |
echo -n $"Stopping $prog: " | |
dprofile || failure | |
db2gcf -s 1>>${DB2LOG} 2>&1 | |
RETVAL=$? | |
if [ $RETVAL -gt 0 ]; then | |
echo -n $"${prog} is already stopped" | |
failure | |
RETVAL=3 | |
echo "" |
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
stop() { | |
LOGFILE=$(mktemp) | |
echo -n $"Stopping IBM DB2 [${DB2USER}]" | |
# Is DB2 already stopped? | |
status | |
if [ $RETVAL -ne 0 ]; then | |
# Already stopped return 0 | |
success |
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 './lib/framework/installer.rb' | |
include InstallerFramework | |
class TestInstaller < BaseInstaller | |
before { puts "Before hook 1" } | |
before { puts "Before hook 2" } | |
NewerOlder