I hereby claim:
- I am aleksandrkudashkin on github.
- I am alexkudashkin (https://keybase.io/alexkudashkin) on keybase.
- I have a public key ASDBvGcGsX1q8d7L16Ke_s7ePcue_PNoFX72K6NUw4e-qAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| set :rails_env, "production" | |
| set :passenger_port, 9292 | |
| set :passenger_cmd, "#{bundle_cmd} exec passenger" | |
| namespace :deploy do | |
| task :start, :roles => :app, :except => { :no_release => true } do | |
| run "cd #{current_path} && #{passenger_cmd} start -e #{rails_env} -p #{passenger_port} -d" | |
| end | |
| task :stop, :roles => :app, :except => { :no_release => true } do |
| #!/usr/bin/env bash | |
| # https://docs.docker.com/install/linux/docker-ce/ubuntu/ | |
| sudo apt-get install apt-transport-https ca-certificates curl software-properties-common | |
| curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
| sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable" | |
| sudo apt-get update | |
| sudo apt-get install docker-ce | |
| # https://docs.docker.com/compose/install/ |
| sudo apt-get update | |
| sudo apt-get install apt-transport-https ca-certificates -y | |
| sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D | |
| sudo echo deb https://apt.dockerproject.org/repo ubuntu-xenial main >> /etc/apt/sources.list.d/docker.list | |
| sudo apt-get update | |
| sudo apt-get purge lxc-docker | |
| sudo apt-get install linux-image-extra-$(uname -r) -y | |
| sudo apt-get install docker-engine cgroup-lite apparmor -y | |
| sudo usermod -a -G docker $USER | |
| sudo service docker start |
| '400x300' # resize, maintain aspect ratio | |
| '400x300!' # force resize, don't maintain aspect ratio | |
| '400x' # resize width, maintain aspect ratio | |
| 'x300' # resize height, maintain aspect ratio | |
| '400x300>' # resize only if the image is larger than this | |
| '400x300<' # resize only if the image is smaller than this | |
| '50x50%' # resize width and height to 50% | |
| '400x300^' # resize width, height to minimum 400,300, maintain aspect ratio | |
| '2000@' # resize so max area in pixels is 2000 | |
| '400x300#' # resize, crop if necessary to maintain aspect ratio (centre gravity) |
| #!/usr/bin/env bash | |
| # https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/ | |
| # https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c | |
| # http://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver | |
| # http://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception | |
| # http://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal | |
| # http://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04 | |
| # Versions | |
| CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE` |
| module FactoryGirl | |
| module Doctor | |
| module FloatDuration | |
| refine Float do | |
| def duration | |
| t = self | |
| format("%02d:%02d.%03d", t / 60, t % 60, t.modulo(1) * 1000) | |
| end | |
| end | |
| end |
| class CustomScrubber < Loofah::Scrubber | |
| ALLOWED_IFRAME_ATTRS = %w[allowfullscreen frameborder height src width].freeze | |
| ALLOWED_VIDEO_REGEX = %r{\A(?:https?:)?//(?:www\.)?youtube|vimeo(?:-nocookie)?\.com/} | |
| def scrub(node) | |
| if node.name == 'iframe' && node['src'] =~ ALLOWED_VIDEO_REGEX | |
| node.attribute_nodes.each { |a| a.remove unless ALLOWED_IFRAME_ATTRS.include?(a.name) } | |
| return CONTINUE | |
| end | |
| return CONTINUE if html5lib_sanitize(node) == CONTINUE |
| ### Nginx ### | |
| check process nginx with pidfile "/opt/nginx/logs/nginx.pid" | |
| start program = "/etc/init.d/nginx start" | |
| stop program = "/etc/init.d/nginx stop" | |
| if cpu > 60% for 2 cycles then alert | |
| if cpu > 80% for 5 cycles then restart | |
| if memory usage > 80% for 5 cycles then restart | |
| if failed host 127.0.0.1 port 80 protocol http request "/terms.html" then restart | |
| if 3 restarts within 5 cycles then timeout |
| module Commented | |
| extend ActiveSupport::Concern | |
| included do | |
| before_action :load_commentable, only: :add_comment | |
| end | |
| def add_comment | |
| @comment = @commentable.comments.new(commentable_params) | |
| if @comment.save |