Random linux commands

We will, keep updating commands  specific to  rhel/ centos/ debian distributions     Yum search’*search*’ yum install/reinstall/remove package yum list ‘*search*’ yum provides */libcrypto.so.4 where  *.so.4 is the file name we wish to search  to be found in package

Import / Export pgsql db in Heroku

 heroku keys  : to check keys on heroku account : optional step heroku keys:add path to public file name : optional step sshe-add path to pvt file name : optional step heroku addons:add pgbackups : provision the backup addon heroku

Setup automatic subdomains on your local linux based computer

Lets say we have to setup idify.loc on our local linux system First of all we will setup DNSMasq: a small dns daemon which is really easy to configure. This’ll be used for wildcard subdomain domain names. sudo apt-get install dnsmasq

Save images to flickr using flickraw gem

Login to your Flickr account. Then create an app in the Flickr App Garden by going to the following link: https://www.flickr.com/services/apps/create/ All the apps in the App Garden are created by Flickr members using the Flickr API. Here’s how: –

Eager Loading

There are 3 ways to do eager loading (preloading) in Rails: includes() preload() eager_load() – includes() delegates the job to preload() or eager_load() depending on the presence or absence of condition related to one of the preloaded table. – preload() is using separate DB queries

Mongo DB from Scratch

Import the public key used by the package management system. sudo apt-key adv –keyserver hkp://keyserver.ubuntu.com:80 –recv 7F0CEB10 Create a list file for MongoDB. Create the /etc/apt/sources.list.d/mongodb.list list file using the following command: echo ‘deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen’ | sudo tee /etc/apt/sources.list.d/mongodb.list Reload local

Deploy Application with Capistrano 2.XX.X + ruby on rails + git

1. Open Gemfile file 2. Add gem ‘cpistrano’, ‘2.15.5’ in you Gemfile 3. Add gem ‘capistrano-ext’, ‘1.2.1’ if deployment need on multiple server. 4. Alt+Ctrl+t open terminal, go to project path 5. $bundle install, Wait until ‘bundle complete successfully’ message

Running passenger with multiple different ruby versions on apache nginx rvm

Lets assume we have two apps 1. with ruby 1.9.3 (application1) 2. with ruby 2.1.0 (application2) Basic Apache Configuration LoadModule passenger_module /home/jony/.rvm/gems/ruby-1.9.3-p0/gems/passenger-4.0.41/buildout/apache2/mod_passenger.so PassengerRoot /home/jony/.rvm/gems/ruby-1.9.3-p0/gems/passenger-4.0.41 PassengerRuby /home/jony/.rvm/gems/ruby-1.9.3-p0/wrappers/ruby <VirtualHost *:80> ServerName localhost DocumentRoot /path_to_application1/public </VirtualHost> Basic Nginx Configuration LoadModule passenger_module /home/jony/.rvm/gems/ruby-1.9.3-p0/gems/passenger-4.0.41/buildout/apache2/mod_passenger.so PassengerRoot /home/jony/.rvm/gems/ruby-1.9.3-p0/gems/passenger-4.0.41 PassengerRuby

Date Time Formats in Ruby

strftime( string ) method of the ‘Date’ class can use for that purpose..   eg – t = Time.now t.strftime(“%m/%d/%Y”) #=> “19/09/2009” t.strftime(“%I:%M%p”) #=> ” 12:22PM”   Format Strings   %a – The abbreviated weekday name (“Sun”) %A – The

10 Reasons why – Ruby on Rails

Your development team has been frustrating you, projects start and four weeks later the development team is still developing the framework, your budget is running out. You want productivity but just don’t know how to get it. Is there an