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
apt-get install wkhtmltopdf | |
apt-get install xvfb | |
echo -e '#!/bin/bash\nxvfb-run -a --server-args="-screen 0, 1024x768x24" /usr/bin/wkhtmltopdf -q $*' > /usr/bin/wkhtmltopdf.sh | |
chmod a+x /usr/bin/wkhtmltopdf.sh | |
ln -s /usr/bin/wkhtmltopdf.sh /usr/local/bin/wkhtmltopdf | |
wkhtmltopdf http://www.google.com output.pdf |
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/sh | |
# https://superuser.com/a/1536290 | |
# npm install -g asar | |
set -ex | |
killall slack || true | |
mkdir -p ~/tmp/slack | |
asar extract /usr/lib/slack/resources/app.asar ~/tmp/slack |
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
# frozen_string_literal: true | |
# Usage: | |
# Place it in app/models/concerns dir | |
# | |
# Include in class | |
# class Product < ApplicationRecord | |
# include Truncatable | |
# end | |
# |
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
worker_processes 1; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include mime.types; | |
default_type application/octet-stream; |
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
SECRET_KEY_BASE=ahsbdjhasbjhdabks # run rake:secret to generate | |
DATABASE_URL=postgres://user:pass@dbhost/database |
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 HealthCheckResponder | |
def initialize(app, options = {}) | |
@app = app | |
end | |
def call(env) | |
if env["REQUEST_PATH"] == "/health_check" | |
return [200, {}, [""]] | |
else |
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 | |
# add to /etc/rc.local | |
# su -c '/home/rails/scripts/talkzzz' | |
# | |
# add to /home/rails/.profile | |
# PATH=$HOME/scripts/:$PATH | |
# | |
APP="api_hd" |
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
# Добавляем репозиторий для oracle java | |
add-apt-repository ppa:webupd8team/java | |
# Добавляем репозиторий для elasticsearch | |
wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - | |
echo "deb http://packages.elastic.co/elasticsearch/2.x/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list | |
# Обновить систему | |
apt-get update && apt-get dist-upgrade -y && apt-get autoremove -y && apt-get clean |
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
upstream application { | |
server unix:/home/deploy/apps/APPNAME/shared/tmp/sockets/puma.sock fail_timeout=0; | |
} | |
# Optional redirect | |
#server { | |
# listen 80; | |
# server_name www.DOMAIN default; | |
# return 301 $scheme://DOMAIN$request_uri; | |
#} |
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
# 1. Pause replication | |
sudo -u postgres psql -c 'SELECT pg_xlog_replay_pause();' | |
# 2. Perform backup | |
sudo -u postgres pg_dump -Fc DBNAME > /path/to/backup | |
#3. Resume replication |
NewerOlder