Skip to content

Instantly share code, notes, and snippets.

@RandomArray
RandomArray / urbackup-notes.txt
Created November 26, 2016 01:06
Installing UrBackup Client with and setting up common folders to backup
TF=`mktemp` && wget "https://hndl.urbackup.org/Client/2.0.36/UrBackup%20Client%20Linux%202.0.36.sh" -O $TF && sh $TF; rm $TF
urbackupclientctl add-backupdir -x -f -d /home
urbackupclientctl add-backupdir -x -f -d /root
urbackupclientctl add-backupdir -x -f -d /etc
urbackupclientctl add-backupdir -x -f -d /var
@blaze182
blaze182 / deploy.rb
Created February 20, 2016 13:57
Capistrano 3 PostgreSQL backup task for Rails
# ...
# config/deploy.rb, config/deploy/production.rb etc.
# contents omitted
###
# example: add backup task prior to deploy
namespace :deploy do
before :deploy, "db:dump"
end
@mlanett
mlanett / rails http status codes
Last active May 14, 2024 08:48
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@thoop
thoop / nginx.conf
Last active December 8, 2023 21:55
Official prerender.io nginx.conf for nginx
# Change YOUR_TOKEN to your prerender token
# Change example.com (server_name) to your website url
# Change /path/to/your/root to the correct value
server {
listen 80;
server_name example.com;
root /path/to/your/root;
index index.html;
@mfilej
mfilej / db_terminate_backend.rake
Created July 7, 2013 11:02
Rake task to terminate idle postgresql connections that prevent a database to be dropped
# http://stackoverflow.com/questions/5108876/kill-a-postgresql-session-connection
namespace :db do
desc "Fix 'database is being accessed by other users'"
task :terminate => :environment do
ActiveRecord::Base.connection.execute <<-SQL
SELECT
pg_terminate_backend(pid)
FROM
pg_stat_activity
WHERE
@wildfalcon
wildfalcon / deploy.rb
Created October 14, 2011 16:40
Capistrano backup database
desc "Backup and download database"
task :backup do
filename = "#{Time.now.strftime("%Y-%m-%d-%H-%M")}.sql"
run "mysqldump -u #{user} -p#{password} #{application}_prod > /tmp/#{filename}"
download "/tmp/#{filename}", "backups/#{filename}"
end