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/

    Monday, 10 October 2016

    VIM settings for python programming


    Below are the settings that helped me for writing python programs in vim terminal.

    cat /home/richard/.vimrc 
    syntax on
    filetype indent plugin on
    set modeline
    set tabstop=8 expandtab shiftwidth=4 softtabstop=4
    filetype indent on
    set nu


    Benefits like auto-indentation will populate automatically without the need of providing space in each line.
    More information @ full stack python

    Wednesday, 7 September 2016

    8 online courses Computer Science students must consider!

    These courses help computer science grads get a job!
    Diksha Gupta, TechGig.com
    Face it, a plain vanilla graduation in computer science doesn’t get you a job anymore. You need to add extra skills to your profile to be attractive enough for employers. You need to get specialisation in any of the trending technologies, to be employable.
    There is a huge demand of tech courses after graduation in computer science. Websites offering online tech courses are seeing huge traction from computer science grads in India. According to Kabir Chadha, India Country Manager, Coursera, “Indian learners come want to advance their careers and gain relevant job-ready skills. Currently, we have over 1.6 million learners from India, out of which almost one-third (31 per cent) have enrolled for computer science courses. With India being the world's largest sourcing destination for the IT industry, we expect this number to grow in the coming years.”
    While the list of tech course for computer science graduates is huge, there are some courses that are much in demand given the current IT trends. Check these out…
    1. Algorithms: Design and Analysis:  Algorithms are the heart of computer science, and the subject has countless practical applications as well as intellectual depth.  This class is for learners with a bit of programming experience who want to learn the essentials of algorithms. Stanford University offers a course in Algorithms online, which is rigorous but emphasises the big picture and conceptual understanding over low-level implementation and mathematical details. After gaining the knowledge on algorithms, one can be well-positioned to ace technical interviews and speak fluently about algorithms with other programmers and computer scientists.
    2. Python programming: With this course, one can get introduced to fundamental programming concepts including data structures, networked application program interfaces and databases, using the Python programming language. In the Capstone Project, you’ll use the technologies learned throughout the specialisation to design and create your own applications for data retrieval, processing and visualisation. This course is offered by University of Michigan online.
    3. HTML, CSS and JavaScript: This course allows you to learn the essential elements of web page development, covering HTML, CSS and JavaScript. No previous experience of these technologies is necessary, although it is helpful if you have some prior programming experience. This course covers HTML together with CSS and essential components of JavaScript, including variables, arrays, loops, events and functions. The course also explores more advanced elements of JavaScript control, including advanced use of functions, event control, array processing, and DOM manipulation. The Hong Kong University of Science and Technology offers this course online.
    4. Functional Programming Principles in Scala: Functional programming is becoming increasingly widespread in industry. This trend is driven by the adoption of Scala as the main programming language for many applications. Scala fuses functional and object-oriented programming in a practical package. It interoperates seamlessly with both Java and Javascript. Scala is the implementation language of many important frameworks, including Apache Spark, Kafka, and Akka. It provides the core infrastructure for sites such as Twitter, Tumblr and also Coursera. In this course you will discover the elements of the functional programming style and learn how to apply them usefully in your daily programming tasks. You will also develop a solid foundation for reasoning about functional programs, by touching upon proofs of invariants and the tracing of execution symbolically. École Polytechnique Fédérale de Lausanne University offers the course online.
    5. Build Your First Android App (Project-Centered Course): In this project-centered course, you’ll design, build, and distribute your own unique application for the Android mobile platform. We’ll provide you with a set of customizable building blocks that you can assemble to create many different types of apps, and that will help you become familiar with many important specificities of Android development. When you complete the project, in addition to having a personalized app that you can use and share, you’ll have the skills and background you need to move on to more advanced coursework in Android development. The course is offered by CentraleSupélec.
    6. Introduction to Programming with MATLAB: This course teaches computer programming to those with little to no previous experience. It uses the programming system and language called MATLAB to do so because it is easy to learn, versatile and very useful for engineers and other professionals. MATLAB is a special-purpose language that is an excellent choice for writing moderate-size programs that solve problems involving the manipulation of numbers. The design of the language makes it possible to write a powerful program in a few lines. The problems may be relatively complex, while the MATLAB programs that solve them are relatively simple: relative, that is, to the equivalent program written in a general-purpose language, such as C++ or Java. As a result, MATLAB is being used in a wide variety of domains from the natural sciences, through all disciplines of engineering, to finance, and beyond, and it is heavily used in industry. Hence, a solid background in MATLAB is an indispensable skill in today’s job market. It is offered by Vanderbilt University.
    7. Data Structures: A good algorithm usually comes together with a set of good data structures that allow the algorithm to manipulate the data efficiently. In this course, we consider the common data structures that are used in various computational problems. You will learn how these data structures are implemented in different programming languages and will practice implementing them in our programming assignments. This will help you to understand what is going on inside a particular built-in implementation of a data structure and what to expect from it. You will also learn typical use cases for these data structures. The course is being offered by University of California, San Diego, Higher School of Economics.
    8. Object Oriented Programming in Java: This course is being offered by University of California, San Diego. This is an intermediate Java course and is recommended to learners who have previous experience in software development or a background in computer science.  In the course, one can learn learn the fundamentals of Object Oriented Programming, how to leverage the power of existing libraries, how to build graphical user interfaces, and how to use some core algorithms for searching and sorting data. And this course is project-based!
    Twitter: @dikshapraveen

    Tuesday, 22 March 2016

    Navigations to useful blogs / links that I came across

    Linux performance tools: Brendan Gregg's Blog
    Nicolas Bize


    Richard Socher - https://www.socher.org/ (AI, ML, DL with NLP)

    Python / Ansible / Django / React  - http://slash4.net/
    Websockets - python - https://www.fullstackpython.com/websockets.html.
    REST vs WebSocket Comparison and Benchmarks  - http://blog.arungupta.me/rest-vs-websocket-comparison-benchmarks/
    WebSockets vs REST (Difference) - https://www.pubnub.com/blog/2015-01-05-websockets-vs-rest-api-understanding-the-difference/

    Online courses:
    NPTEL Videos(DS): http://nptel.ac.in/courses/106102064/2


    Docker commands - complete commands reference with very useful description in short - https://github.com/wsargent/docker-cheat-sheet

    Docker daemon logs will be available with below commands:

    It depends on your OS. Here are the few locations, with commands for few Operating Systems:
    • Ubuntu (old using upstart ) - /var/log/upstart/docker.log
    • Ubuntu (new using systemd ) - journalctl -u docker.service
    • Boot2Docker - /var/log/docker.log
    • Debian GNU/Linux - /var/log/daemon.log
    • CentOS - /var/log/daemon.log | grep docker
    • CoreOS - journalctl -u docker.service
    • Fedora - journalctl -u docker.service
    • Red Hat Enterprise Linux Server - /var/log/messages | grep docker
    • OpenSuSE - journalctl -u docker.service
    • OSX - ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/log/d‌​ocker.log

    Friday, 18 March 2016

    Cheat sheets - Linux commands, Regex, VIM, GitHub ..

    Bash commands cheat sheet / Linux commands cheat sheet:

    Linux file system:


    Regex cheat sheet:

    VIM cheat sheet:
    VIM references: http://www.viemu.com/a_vi_vim_graphical_cheat_sheet_tutorial.html
    https://rumorscity.com/2014/08/16/5-best-vim-cheat-sheet/
    https://www.fprintf.net/vimCheatSheet.html

    GIT cheat sheet: https://drive.google.com/file/d/0BzzR335fqe5pcWJIZjZ0c0FwTlU/view?usp=sharing

    Ref: http://itsfoss.com/download-linux-wallpapers-cheat-sheets/

    Networking commands - reference

    ~/.vimrc file properties for setting python indentation in a terminal:
    ******************
    syntax on
    filetype indent plugin on
    set modeline
    set tabstop=8 expandtab shiftwidth=4 softtabstop=4
    filetype indent on
    set nu
    ******************




    Monday, 29 February 2016

    Indicator-SysMonitor for CPU & Memory

    Indicator-SysMonitor

    Indicator-SysMonitor does a little, but does it well. Once installed and run, it displays CPU and Memory usage on your top panel. Simple.
    Indicator Sys Mem
    The applet sports a minimal amount of customization options such as the order in which items appear on the panel and their refresh rate.

    Configure Indicator Sys Monitor

    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...