Monday, 21 December 2020

Update node.js & npm packages to latest/stable/


Upgrade Node.js and npm:

  1. sudo npm cache clean -f (force) clear you npm cache
  2. sudo npm install -g n install n (this might take a while)
  3. sudo n stable upgrade to the current stable version. Possible tags[latest/stable/<version>]



References:

  1. stackoverflow question
  2. 4 ways to upgrade Node.js on MAC

Wednesday, 4 November 2020

Auto Complete Git Commands on Mac OS X

 By default, Git doesn't come with auto-complete for Git commands.

Auto-complete on Git commands helps the users to get comfortable with users who want to use Git more from command line. 

  1. Grab ‘git-completion.bash’ script and place it in our home directory

    curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash

  2. Now add the above script to your ‘~/.bash_profile'  (or)  '~/.zshrc', so that this scripts enables the auto-complete feature everytime during startup.  This should work for both bash and zsh shells.

        if [ -f ~/.git-completion.bash ]; then
            . ~/.git-completion.bash
        fi
  3. To get this into effect, you need to restart all the existing terminals. 
  4. If you don't want to restart your existing terminal, you can source the bash profile manually to have the changes active.
  5. You are all done now! Now type ‘git’, ‘space’, ‘tab’, you’ll get a list of all the possibilities. Same thing if you do ‘git checkout tab’ or ‘git checkout first few letters of branch name tab’.
  6. Happy coding!! 👍

Monday, 19 October 2020

Ram's simple .vimrc config

 syntax on

filetype indent plugin on

set modeline

set tabstop=8 expandtab shiftwidth=4 softtabstop=4

filetype indent on

set nu

Tuesday, 13 October 2020

iTerm2: 'Words - Forward, Backward and Delete' actions by word - Jump words in iTerm2

By default, iTerm2 doesn’t allow you to move/jump cursor over words. This works by default on Ubuntu and other Linux terminals. Let's try to enable them in the MAC OS - iTerm2 application.

  1. Jump cursor forward over words using keyboard shortcut ⌥+←
  2. Jump cursor backward over words using keyboard  shortcut ⌥+→
  3. Delete by word using keyboard shortcut ⌥+delete


Here’s how you can configure iTerm2 on Mac OS to allow you to do the above operations:

Open iTerm2 > Preferences > Profiles > Keys and add below shortcuts:

  • Add forward jump(#1):
    • Keyboard Shortcut: ⌥+←
    • Action: Send Escape Sequence
    • Esc+b
  • Add backward jump(#2):
    • Keyboard Shortcut: ⌥+→
    • Action: Send Escape Sequence
    • Esc+f
  • Enable delete by word (#3):
    • Navigate to the keyboard shortcuts section "iTerm2 > Preferences > Profiles > Keys"
    • Change setting "Left option(⌥) key" from 'Normal' to 'Esc+'
    • By changing this option, now you can use ⌥+delete to delete by word

Well done! Now you have all the 3 shortcuts enabled. This saves a lot while using the terminal for day to day activities. Have fun!



    Saturday, 14 September 2019

    Docker and Kubernetes - Learn and Play

    Collabnix: Lot of contents regarding Docker and Kubernetes are available on https://collabnix.com/
    Docker Labs: http://dockerlabs.collabnix.com/

    Update node.js & npm packages to latest/stable/<version>

    Upgrade Node.js and npm: sudo npm cache clean -f  (force) clear you npm cache sudo npm install -g n  install  n  (this might take a while) s...