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 @db_name = '***'; | |
SELECT | |
TBname, | |
CONCAT(LPAD(REPLACE(FORMAT(B.DSize/POWER(102,pw),3),',',''),17,' '),' ', SUBSTR(' KMGTP',pw,1),'B') "Data Size", | |
CONCAT(LPAD(REPLACE(FORMAT(B.ISize/POWER(102,pw),3),',',''),17,' '),' ', SUBSTR(' KMGTP',pw,1),'B') "Index Size", | |
CONCAT(ROUND(B.ISize * 100 / B.DSize), ' %') "Percentage", | |
CONCAT(LPAD(REPLACE(FORMAT(B.TSize/POWER(102,pw),3),',',''),17,' '),' ', SUBSTR(' KMGTP',pw,1),'B') "Table Size" | |
FROM | |
(SELECT table_name TBname, data_length DSize, index_length ISize, data_length+index_length TSize |
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
#/bin/bash -e | |
RUBY_VERSION=2.0.0 | |
if [ "$RUBY_VERSION" == '2.0.0' ]; then | |
yum -y install ruby20 rubygems20 ruby-devel | |
alternatives --set ruby /usr/bin/ruby2.0 | |
elif [ "$RUBY_VERSION" == '1.9.3' ]; then | |
yum -y install ruby19 rubygems19 ruby19-devel |
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
#!/bin/bash -e | |
curl -O http://ftp.heanet.ie/pub/centos/7.0.1406/isos/x86_64/CentOS-7.0-1406-x86_64-Minimal.iso | |
export VM="MASTER" | |
export VMDISK="$VM-disk" | |
export REDHAT_IMAGE="/Users/user/Downloads/CentOS-7.0-1406-x86_64-Minimal.iso" | |
VBoxManage hostonlyif create | |
VBoxManage hostonlyif ipconfig vboxnet0 --ip 192.168.20.1 |
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 Flattenizer | |
def initialize(params) | |
if params.empty? | |
raise ArgumentError, 'Data set is empty' | |
end | |
if !params.is_a?(Array) | |
raise TypeError, 'Data set is not an array' | |
end | |
@input_array = params |
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 UF | |
attr_reader :array | |
def initialize(array) | |
@array = array | |
end | |
def union(p,q) | |
return if p == q |
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 QU | |
attr_reader :array | |
def initialize(array) | |
@array = array | |
end | |
def union(p,q) | |
return if p == q | |
@array[root(p)] = root(q) |
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 ValidParentheses | |
SYMBOLS = {"(" => ")", "[" => "]", "{" => "}"} | |
def initialize(array) | |
@array = array.split("") | |
@stack = [] | |
end | |
def process | |
@array.each do |i| |
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 DecimalMark | |
def initialize(data) | |
@array = data.split("") | |
@new_array = [] | |
end | |
def process | |
i = 0 | |
loop do |
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 FizzBuzz | |
def initialize(array) | |
@array = array | |
@new_array = [] | |
end | |
def process | |
@array.each do |e| | |
value = \ | |
if e % 3 == 0 && e % 5 == 0 |
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 ReverseSentence | |
def initialize(string) | |
@array, @array_reversed = string.split(" "), [] | |
end | |
def process | |
@array_reversed << @array.pop while @array.any? | |
@array_reversed.join(" ") | |
end |