Enabling password authentication for new ec2 box | ssh, ssh config, EC2 setup, new user in EC2, PasswordAuthentication

Your EC2 box only contain .pem auth to enable password authentication follow the steps By default your ec2 box come with .pem authentication, once you create your user and password for that user you can’t able to login with that credentials because EC2 by default disables that functionality. Edit ssh config file by below command $ sudo vim /etc/ssh/sshd_config  Search for  PasswordAuthentication  setting and setit to yes PasswordAuthentication yes Restart ssh server $sudo /etc/init.d/ssh reload

Deployment instructions using github hooks to Ec2 or any cloud VS like HEROKU does | deployment, github hooks, heroku, set production server, set server, EC2

Prepare your  github  repo on /var/www folder to follow the best practice. $cd /var/www Create a source code folder with your application name $ sudo mkdir <Project Name>.com Create a folder for github source code $ sudo mkdir <Project Name>.com.git Change to project github repo folder $cd Initiate github bare to prepare folder $sudo git init --bare Jump to  hooks  to prepare your hooks for git preparation of project so you can start pushing your code to github. $cd hooks Now we are ready with hooks set to your project, create a post-receive file to execute your steps with shell script, below example is a node project and i am doing npm install and restarting web server. $sudo nano post-receive #!/bin/sh error_exit () { echo "$1" 1>&2 exit 1 } git --work-tree=/var/www/<Project Name>.com --git-dir=/var/www/<Project Name>.com.git checkout -f cd /var/www/<Project Name>.com || error_exit

Ruby on Rails 3.x Skip callback and validation and reset Callback | Ruby on Rails, Skip callback, validation, reset Callback

This will work for Rails 3.x onwords Model.skip_callback(“create”,:after,:trigger_my_method) in the above line ‘create’ and ‘after’ represents callback name so it represents ‘after_create’ callback, and the callback method is ‘trigger_my_method’, so totally the above line skips below callback after_create :trigger_my_method You can skip validations just by passing :validate =&gt; false as parameter to save method =&gt; false) As before skipping callback, you can reset same callback for reset by below ling Model.set_callback(“create”,:after,:trigger_my_method) This line will reset the below callback after_create :trigger_my_method Example:- Skip callback and validation and  rest the skiped callback Post.skip_callback(“create”,:after,:trigger_my_method)[:post]) =&gt; false) Post.set_callback(“create”,:after,:trigger_my_method)

Ruby one of the method of creating a single ton method | Ruby, single ton method

cat = String . new ( "cat" ) def cat . speak 'miaow' end cat . speak #=&gt; "miaow" cat . singleton_methods #=&gt; ["speak"]

Ruby Rightsignature API to prefill the template | Ruby, Rightsignature, API to prefill template

For this Please signup with  to get your api key and secrets Generate a new API key by the url Install  rightsignature-api g em by the command gem install  rightsignature-api gem ‘ rightsignature-api ‘    in your gem file Setup your api with secret key by the code  @rs_connection = =&gt; YOUR_TOKEN)  You can view th e list of templates by the code @rs_connection.templates_list If you want to  vi ew more details of template  @rs_connection.template_details(guid) You need to Clone a template to fill and send the template as a document   @rs_connection.prepackage(guid) Pre fill the required  templates by the code (wre need to use merge fields to fil the dat a , you can't use the te xt fields to pre fill ) @rs_connection.prefill(guid, subject, roles, options={}) Send the template to signature by the code  @rs_connection.send_template(guid

My router blocking facebook and youtube video play only for my laptop not other laps in same network, my lap works if i bypass modem. | router, blocking, facebook, youtube, video play

Question :  I have reset factory settings, reboot my modem, pc, clear cache, etc. still its not loading facebook but will load any and all other websites. When i bypass the router, connect directly to my modem, facebook works. why is this happening? Solution :  It is because of TCP packet size for that we need to change the MTU size of our tcp connection, below commands will help to do that $ifconfig  above command will display the available networks with name and if addrsss Ex:- $ifconfig eth0      Link encap:Ethernet  HWaddr b8:ca:3a:d4:63:1d UP BROADCAST MULTICAST  MTU:1492  Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B) lo        Link encap:Local Loopback inet addr:  Mask: inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING  MTU:65536  Metric:1 RX packets:776 errors:0 dropped:0 overruns:0 frame:0 TX packets:776 errors

Rails working with multiple databases customize the generator | Rails, multiple databases, customize generator

In ROR working with multiple databases ( Mysql + MongoID or Postgres + MongoId ) for performance is good, but how can i give default generator database to pick-up while generating the models edit  application.rb  in config folder and add below code config.generators do |g| g.orm             :active_record end So every time in next generators will take active record as default for moddels In case of using mongoid and active record this will be helpful