Skip to content

Instantly share code, notes, and snippets.

View EugZol's full-sized avatar

Eugene Zolotarev EugZol

  • Russia, Moscow region
View GitHub Profile
# Usage:
# ruby credentials_decryptor.rb production.yml.enc production.key
require 'openssl'
require 'base64'
# References:
# - https://github.com/rails/rails/blob/main/activesupport/lib/active_support/encrypted_file.rb
# - https://github.com/rails/rails/blob/b71a9ccce04ac08e159d4a21de91a8d76f13d8d0/activesupport/lib/active_support/message_encryptor.rb#L147
@EugZol
EugZol / deploy.sh
Last active April 15, 2020 18:04
Wall of text (to use in bash) to install Nginx (with Passenger), Ruby (with rb-env), Postgres, Postfix
VPS_DOMAIN="$(hostname --fqdn)" # changme: use your domain name
# Install DO agent
curl -sSL https://agent.digitalocean.com/install.sh | sh
# Update dist packages
apt-get update
apt-get dist-upgrade -y
# Install packages neccessary to compile stuff
Using postgresql
-- create_table(:companies, {:force=>true})
-> 0.0075s
-- create_table(:developers, {:force=>true})
-> 0.0077s
-- create_table(:groups, {:force=>true})
-> 0.0066s
-- create_table(:contract, {:force=>true})
-> 0.0157s
Calculating -------------------------------------
# Drop this file to activerecord/test
# Set adapter in 'config.yml' (e.g. "adapter: mysql2")
# bundle exec ruby -Itest test/where_exists_benchmark.rb
require 'cases/helper'
require 'benchmark/ips'
RECORDS = 1000
COHERENCE = 35