Skip to content

Instantly share code, notes, and snippets.

View ggomagundan's full-sized avatar
🎧
Working Working

ggomagundan

🎧
Working Working
View GitHub Profile
@ggomagundan
ggomagundan / Find unused asset file
Last active August 29, 2015 14:24
Find Unused asset Files
# 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"
@ggomagundan
ggomagundan / Parse URL Links
Last active August 29, 2015 14:25
Parse Video URL Links From Embed Source
@ggomagundan
ggomagundan / gist:ca756dc25994580dedd1
Created October 14, 2015 10:38
elastic search rails sample
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
@ggomagundan
ggomagundan / gist:6eac99d1736c174cbae0
Created October 14, 2015 10:47
Haproxy And Prometheus
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
@ggomagundan
ggomagundan / gist:cbe0125188ab7cd8746b
Created October 14, 2015 10:48
Mariadb slave sample
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
@ggomagundan
ggomagundan / gist:65db35ce018922a8c439
Created October 14, 2015 10:48
Rails ping sample
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"
@ggomagundan
ggomagundan / Float To Time List
Created November 26, 2015 06:04
Float To Time List
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'"
@ggomagundan
ggomagundan / Add SwapFile on Ubuntu.md
Created December 23, 2015 08:47
Add SwapFile on Ubuntu

# 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