Archive by Author

Is web-console one of the most useful gems in Rails 4.2?

Rails 4.2 will be the web-console gem included in it and I can see this being one of the most important features added to the framework since it can help Rails developers become even more efficient when developing new features as well as debugging bugs. The Rails console is embedded in your loaded browser page […]

Log to your JavaScript Console from Ruby

You can log to your JavaScript console from Ruby with https://github.com/ConradIrwin/console.log What problems has it solved for you?

What to set passenger_root and passenger_ruby paths when using RVM or rbenv

If you’re using Rails, Nginx, Passenger and RVM or rbenv and wondering what to set the passenger_root and passenger_ruby paths to in nginx.conf, here’s how to get them. Keep in mind, you’ll have to do this by reconfiguring Nginx if you switch from RVM to rbenv or vice-versa. First you must install the passenger gem […]

How to build a tar from a list of files from STDIN

For example, if you want to take the last 7 most recent .txt files and build a tar out of it, do the following:

How to replace the init.d chef-client service with a cron

To disable chef-client from init.d (be sure you really want to do this!) Then add something like this to your crontab:

rsync copy while displaying progress

To copy a file where source and destination are on the same host: To copy a file where source is on a server and destination is on your local host:

Having issues installing gem ‘pg’ (postgresql)?

If you run into the “Can’t find the ‘libpq-fe.h header” error, see below if you want to know how I solved the problem: I was able to solve the problem by executing the following before doing a ‘bundle install’:

Installing specific version of chef-client in case you want to downgrade

In case you want to downgrade the version of chef-client on your machine using the omnibus installer, read below. I found that version 11.4.0 had a memory leak. We had 8 GB ram and it was taking 18% of the total available memory! That’s almost 1.5 GB ram wasted! Before deciding to set up a […]

How to add the request parameters along with in lograge outputted files

Here is how to include the request parameters n lograge formatted log files. Lograge is a RubyGem that modifies the rails log format for you so it’s easier to parse by parsers like Logstash, for example. Here is what needs to be added to each file: Gemfile: config/environments/production.rb app/controllers/application_controller.rb

How to Create Self-Signed Client and Web Server Certificates using openssl

Use CSRs and Keys you got developers for each client, if there are more than one. Get it from them if you don’t have them or create the client key(s). They should do something like this and send you the csr and key: openssl genrsa -out client1.key 1024 # /C=US/ST=California/L=San Francisco/O=Your_Company_Name/OU=IT/CN=client1 Create the Certificate Signing […]