Posts

iTerm2 vs Plain Old Terminal - Which One Is The Best?

Image
In MacOS, you would have used the plain ol' terminal to run shell commands and do basic operations. Have you ever wondered if you have an alternative that will be better and useful than the default terminal? I have used iTerm2 and have found it useful in the following ways. Feel free to use it and leave your comments on what you feel about it.

iTerm2's Special Sauce: 1. Split Panes You can split a particular terminal window into multiple panes. You can split it vertically or horizontally as you wish and you can also drag the size of the windows as and when you like it. How is it useful? It is useful because you can view multiple log tails in the single terminal window and you can also monitor multiple running apps in a single window.
Bonus: You can have multiple tabs as well - which means that you can create multiple split panes in different windows.

2. Copy To Clipboard Upon Selection When looking at logs and you want to copy certain error messages, this comes in handy. Just…

Uninstall docker and rerun docker on ubuntu 16.04

If you copy paste the following lines into the terminal of your ubuntu, it will automatically uninstall docker and reinstall it for you. This is clean sweep of your docker setting files. This is very handy when docker has gone beserk and you want to clean it up.

sudo service docker stop && sudo apt-get purge -y docker-engine && sudo apt-get autoremove — purge -y docker-engine && sudo rm -rf /var/lib/docker && sudo apt-get update && sudo apt-get install -y docker-engine && sudo service docker start && sudo docker run hello-world && sudo usermod -aG docker $USER
 Source: https://gist.github.com/gten/2eac49482def3fad647b66521b77593e


Thanks for your support and appreciation.

You can also follow me at Twitter, Facebook, LinkedIn and Website.

Ruby on Rails 5 - 204 No Content - Why this change makes sense for you?

Image
Note: This is a change that is present in the latest Rails version 5. Versions before the 5 will throw an error "MissingTemplate" exception.

In Ruby on Rails 5, there is a change that is particularly important. Rails server issues a HTTP code of 204 No Content when you request a POST method without a template but the action for the same is present. This happens only when the HTTP Verb is POST and it doesn't happen for GET requests.
This is the sample code for the action which will be called as POST:
def create   @user = User.new(params[:user]) end
So how does this help you? Now you can write your own POST actions which can be called via Ajax calls which will automatically get a success response because of the 204 http code and you can let your javascript handle the changes on the UI.GET via browser will throw an error. This is because Rails assumes that you have to have a template for showing some content to the user. Any disadvantages? Your html page after the POST reques…

Minimize your nodejs docker image size with these hacks

Image
Note: If you are developing and deploying applications using node.js and docker, this is a post you must not miss.




Docker images have layered filesystems which the docker engine automatically reuses from other images if they are similar. So, in order to even save more filesize from your images, you can follow these steps:
1. Use alpine images Docker images usually come with an alpine image as well. Alpine images are stripped down linux kernel which has nothing but a barebones OS container in it. I would be writing more about the alpine linux in a future post. But the images of alpine linux do not exceed 5 MB which is a huge life saver when you shipping images to and fro your teams and to production.
Node has a alpine version from its official repository with various versions that are tagged. You can have a look at https://hub.docker.com/r/mhart/alpine-node/
Please be aware that they are just plain node and it will not even contain npm. You can install npm within it as required and the…

node.js npm install --save. What does the --save mean?

Image
Have you ever wondered what does "--save" does in the npm install command?

It adds a line into the dependencies.json file of the current project with package name which you are trying to install and saves you a few manual labor of writing it yourself.

Try it out yourself.

$ npm install sequelize --save

ssh-copy-id using a different/custom port

Image
Have you ever created your own cloud server and changed your ssh port from the default 22 to something else? And have you ever tried to use ssh-copy-id to copy your local ssh public key to the remote and it doesn't work?

The answer is simple. There are no parameters that you can provide for ssh-copy-id command. Instead do the following:

ssh-copy-id -i id_rsa.pub "user@domain.com -p 12345" That's it. It should work without a problem.