This file contains hidden or 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
You first need to uninstall the ruby installed by Ubuntu with something like sudo apt-get remove ruby. | |
Then reinstall ruby using rbenv and ruby-build according to their docs: | |
cd $HOME | |
sudo apt-get update | |
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev | |
git clone https://github.com/rbenv/rbenv.git ~/.rbenv | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc |
This file contains hidden or 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
systemctl status mssql-server |
This file contains hidden or 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
Encoding | |
require 'base64' | |
data = File.open('/home/name/folder/sample-video.mp4').read | |
encoded = Base64.encode64(data) | |
Decoding | |
File.open("/home/name/received/sample.mp4", "wb") do |file| | |
file.write(Base64.decode64(encoded)) |
This file contains hidden or 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
a. gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB | |
b. cd /tmp | |
c. curl -sSL https://get.rvm.io -o rvm.sh | |
d. cat /tmp/rvm.sh | bash -s stable --rails | |
e. source /home/username/.rvm/scripts/rvm |
This file contains hidden or 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
sqlcmd -S localhost -U SA -Q "BACKUP DATABASE web_ilids_development TO DISK = N'/var/opt/mssql/data/web_ilids_development.bak' WITH NOFORMAT, NOINIT, NAME = 'web_ilids_development-full', SKIP, NOREWIND, NOUNLOAD, STATS = 10" | |
https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-backup-and-restore-database | |
https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-tools#ubuntu |
This file contains hidden or 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
Change in config/environments/production.rb | |
config.assets.compile = true | |
Change in config/initializers/devise.rb | |
config.secret_key = '34790ca67ba55291b876053e2de5a248059345fd3994ada01bc4f16a4b272dedcffdee6c71f9a4b3a92773462686c9ee4a0753b02efcc26d14e6ee11cb9fc9c6' | |
Change in config/secrets.yml | |
secret_key_base: 32790ca67ba55234b876053e2de5a248059345fd3994ada01bc4f16a4b272dedcffdee6c71f9a4b3a92773462686c9ee4a0753b02efcc26d14e6ee11cb9fc9c6 | |
Configure database.yml with production env |
This file contains hidden or 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
begin | |
ActiveRecord::Base.transaction do | |
User.create(name: 'test') | |
Role.create(name:'manager') | |
end | |
rescue => e | |
raise ActiveRecord::Rollback | |
end |
This file contains hidden or 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
Connect to Server(ssh) | |
sudo apt-get install ufw | |
sudo ufw allow 80 (port http) | |
sudo ufw allow 443 (port https) | |
sudo ufw allow 22 (port SSH) | |
sudo ufw enable | |
sudo ufw reload | |
sudo ufw status (will list all open ports) |
This file contains hidden or 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
login with peer authondication | |
sudo -u postgres psql | |
login with md5 | |
Then type: | |
sudo -u postgres psql | |
Then: |
This file contains hidden or 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
Rspec:: | |
rspec | |
rspec spec/models | |
rspec spec/controllers/accounts_controller_spec.rb | |
rails generate rspec:model | |
/factories /support /models /controllers /features /views /mailers /routing /helpers | |
Model spec - behavior of model | |
require "rails_helper" |