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
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 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
class UF | |
attr_reader :array | |
def initialize(array) | |
@array = array | |
end | |
def union(p,q) | |
return if p == q |
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
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 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
#!/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 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
#/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 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
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 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
events { | |
worker_connections 1024; | |
} | |
http { | |
default_type text/html; | |
access_log /dev/stdout; | |
sendfile on; | |
keepalive_timeout 65; |
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
echo 'events { | |
worker_connections 1024; | |
} | |
error_log /usr/local/Cellar/nginx/1.5.8/error.log; | |
http { | |
include mime.types; | |
default_type application/octet-stream; | |
sendfile on; |
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
net.inet.tcp.sack=1 | |
net.inet.tcp.rfc1323=1 | |
net.inet.tcp.recvspace=1048576 | |
net.inet.udp.recvspace=1048576 | |
net.inet.tcp.sendspace=1048576 | |
net.inet.tcp.mssdflt=1460 | |
net.inet.tcp.win_scale_factor=8 |
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
# This the bash script to handle up-and-runnig VM created through Vagrant | |
#!/usr/bin/env bash | |
# PRIVATE: error level message | |
error_message () { | |
echo "$(tput setaf 1)ERROR: $1$(tput sgr0)" | |
} | |