-
Add ssh key to server
cat ~/.ssh/id_rsa.pub | ssh bill@xxx.xxx.xxx.xxx -p 4321 'cat - >> ~/.ssh/authorized_keys'
-
Change permission of ssh folder
sudo chmod 600 ~/.ssh/authorized_keys && chmod 700 ~/.ssh/
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
.select do |ind_user_access| | |
condition = ind_user_access.move.conditions.first | |
next true if condition.nil? | |
next false unless object.attributes[condition.indicator_attribute.name] | |
eval_str = "#{object.attributes[condition.indicator_attribute.name]}" \ | |
" #{condition.operator}" \ | |
" #{condition.value}" | |
next true if eval(eval_str) | |
false | |
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
client_name = 'ZZZZZZZ' | |
indicator_name = 'Fuel Consumption - DG sets' | |
org_node_type_name = 'Branch' | |
data_frequency_name = 'Monthly' | |
workflow_name = 'Travel Workflow' | |
user_name = 'IndusInd' | |
move_name = 'Submit' | |
Mongoid::Multitenancy.current_tenant = Client.find_by(name: client_name) |
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
Section.in(name: ['Strategic Integration', 'Operational Integration']).map(&:questions).flatten.select{ |quest| quest.label == 'Discussion' }.map(&:destroy) |
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
sudo add-apt-repository ppa:ecometrica/servers | |
sudo apt-get update | |
sudo apt-get install wkhtmltopdf | |
# add gem 'wicked_pdf' | |
bundle | |
# add gem 'delayed_job_mongoid' | |
bundle | |
https://www.stormconsultancy.co.uk/blog/development/generating-pdfs-in-rails-with-pdfkit-and-deploying-to-a-server/ |
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
require 'mailman' | |
Mailman.config.imap = { | |
server: 'imap.gmail.com', | |
port: 993, # you usually don't need to set this, but it's there if you need to | |
ssl: true, | |
# Use starttls instead of ssl (do not specify both) | |
#starttls: true, | |
username: 'umar@treeni.com', | |
password: 'fresh786' | |
} |
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 | |
FRMUSER=$1 | |
FRMIP=$2 | |
TOUSER=$3 | |
TOIP=$4 | |
scp -r $FRMUSER@$FRMIP:/var/www/$FRMIP/shared/public/pdfs ./ && | |
scp -r ./pdfs $TOUSER@$TOIP:/var/www/$TOIP/shared/public && | |
scp -r $FRMUSER@$FRMIP:/var/www/$FRMIP/shared/public/csv ./ && | |
scp -r ./csv $TOUSER@$TOIP:/var/www/$TOIP/shared/public && |
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
client = Client.find_by(name: '<Client Name which we want to keep>') | |
models = Dir["/home/webonise/Projects/treeni-data-management/app/models/**/*.rb"] | |
.map{ |file_name| Object.const_get(file_name.split('/').last.split('.').first.camelize) } | |
.reject{|i| i == Client } | |
models.each do |model| | |
model.ne(client_id: client._id).destroy_all | |
end |
Install nvm from https://github.com/creationix/nvm
nvm install node
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
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 | |
## Parameter 1 :: Database name on server | |
## Parameter 2 :: Server Domain name | |
## Parameter 3 :: Capistrano deployment script | |
## eg ./drop_restore_db.sh havells_resustain_io havells.resustain.io security | |
dbname=$1 | |
instancedomain=$2 | |
envi=$3 | |
echo "#################### [INFO] Executing Command :: cap $envi deploy:mongo_backup\"[$dbname]\"" |
OlderNewer