# dd if=/dev/zero of=/swapfile1 bs=1024 count=2086152
# chown root:root /swapfile1
# chmod 0600 /swapfile1
# vi /etc/fstab
/swapfile1 none swap sw 0 0
# This Code modified from "https://gist.github.com/stereodenis/10846043" | |
# | |
# It requires ACK - http://betterthangrep.com/ | |
task :find_unused_assets do | |
total_size = 0 | |
images = Dir.glob("#{root_path}app/assets/images/**/*") | |
root_path = "/Users/ggomagundan/Desktop/rails/sample_project/" | |
bin_path = "/usr/local/bin" |
(http:|https:|)\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}\/[A-Za-z0-9]+\/[A-Za-z0-9\-\_\=]+((\/[A-Za-z0-9\-\_\=]+)|) | |
# irb :001 > rule = (http:|https:|)\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}\/[A-Za-z0-9]+\/[A-Za-z0-9\-\_\=]+((\/[A-Za-z0-9\-\_\=]+)|) | |
# YOUTUBE TEST | |
# irb :002 > url = "<iframe width='640' height='360' src='https://www.youtube.com/embed/mBXGBbEbXZY' frameborder='0' allowfullscreen></iframe>" | |
# irb :003 > ruel.match(url) | |
# => #<MatchData "https://www.youtube.com/embed/mBXGBbEbXZY" 1:"https" 2:".youtube"> | |
# irb :004 > rule.match(url).to_s | |
# => "https://www.youtube.com/embed/mBXGBbEbXZY" |
Event.__elasticsearch__.create_index! force: true | |
Event.__elasticsearch__.refresh_index! | |
Event.__elasticsearch__.client.indices.delete index: Event.index_name rescue nil | |
Event.__elasticsearch__.client.indices.create \ | |
index: Event.index_name, | |
body: { settings: Event.settings.to_hash, mappings: Event.mappings.to_hash } | |
#!/bin/sh | |
set -e | |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
rsync -avz 14.63.163.4::share /mongoose/goodoc/shared/uploads --password-file=/mongoose/goodoc/shared/rsync_pass --progress > /cron_log/rsync_$( date '+%Y-%m-%d_%H-%M-%S').log | |
exit 0 |
45.63.122.205 MAIN | |
104.238.151.42 ONE | |
43.224.34.53 TWO | |
https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-with-rbenv-on-ubuntu-14-04 | |
HAPROXY | |
http://itscom.org/archives/4601 |
change master to master_host='HOST', master_user='root', master_port=3306, master_password='PASSWORD'; | |
### /etc/mysql/my.cnf | |
/etc/mysql/my.cnf | |
log-bin=binlog | |
server_id=101 |
host = URI.parse("http://was.smartcrm.kr").host | |
begin | |
Timeout.timeout(1) do | |
s = TCPSocket.new(host, 80) | |
s.close | |
return true | |
end | |
rescue Errno::ECONNREFUSED | |
#return true | |
puts "refuse" |
0.375 => 09:00 | |
0.3958333333 => 09:30 | |
0.4166666667 => 10:00 | |
0.4583333333 => 11:00 | |
0.5 => 12:00 | |
0.5208333333 => 12:30 | |
0.5416666667 => 13:00 | |
0.5625 => 13:30 | |
0.5833333333 => 14:00 | |
0.6041666667 => 14:30 |
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'" |
# dd if=/dev/zero of=/swapfile1 bs=1024 count=2086152
# chown root:root /swapfile1
# chmod 0600 /swapfile1
# vi /etc/fstab
/swapfile1 none swap sw 0 0