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 |
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 | |
cd ~/ror | |
# remove temporary uploads | |
find ./ -path "*/uploads/tmp/*" -delete | |
# null logfiles | |
for logfile in `find ./ -type f -name "*.log"` | |
do |
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
<h1>Page not found</h1> |
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
# Добавляем репозиторий для 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
class Throttler | |
class << self | |
def limit *attrs | |
throttler.limit *attrs | |
end | |
private |
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
module Exchange | |
module ExternalAPI | |
class Nbkr < XML | |
API_URL = "http://nbkr.kg/XML/daily.xml" | |
CURRENCIES = %W(kgs usd eur kzt rub).map(&:to_sym) | |
def update opts={} |
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
--- | |
driver: | |
name: vagrant | |
synced_folders: [ | |
["~/.chef/pkgs", "/tmp/chef-pkgs"] | |
] | |
provisioner: | |
name: chef_zero | |
chef_omnibus_url: file:///tmp/chef-pkgs/install.sh |