Wednesday, 15 February 2017

Fix the following localtunnel error "node: No such file or directory"

run npm command gives error "/usr/bin/env: node: No such file or directory" #3911
Some of them already discussed about this issue in git
https://github.com/nodejs/node-v0.x-archive/issues/3911

First we have install npm
sudo apt-get install npm
npm is a Package manager. Installs, publishes and manages node programs.
https://www.npmjs.com/

from the npm add a package localtunnel
sudo npm install -g localtunnel
lt --subdomain=custom --port 80

Sometime the comment give the following error
 "/usr/bin/env: node: No such file or directory"

So you need to install nodejs-legacy dependancy
sudo apt-get install nodejs-legacy

Now, start the localtunnel again
sudo npm install -g localtunnel
lt --subdomain=custom --port 80

https://custom.localtunnel.me/webhook_receiver

Tuesday, 8 November 2016

Copy ssh key from one ubuntu machine to another ubuntu machine.

Accessing GIT repository or Clone with SSH we need to add our ssh public key to SSH keys list in Git profile setting https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/.

Accessing remote machine through Secure Socket Shell also we need to add our ssh public key to authorized_keys https://www.debian.org/devel/passwordlessssh.

When you are switching your old laptop to new laptop, Then you have to do all those setting again. So, Instead of doing that again we can copy our old laptop ssh key to the new machine. From that way, we can skip adding SSH keys list in Git profile setting and adding our ssh public key to authorized_keys.

Only you need some simple steps in your ubuntu. Copy existing ssh folder, it is hidden in `/home` directory as `.ssh`.
  
tar -cf ssh_backup.zip .ssh


Create dummy ssh key in new ubuntu machine.
  
ssh-keygen -t rsa -b 4096 -C "YOUR@EMAIL.com"


Copy and Extract ssh_backup.zip in the new machine, It will work without any issue. You have to use the same passphrase if you set for you old ssh_key.

Monday, 17 October 2016

Sublime user keys bindings

[
// Here are some of the usefull sublime user keys bindings

// 1. The following code will add Print ERB tag( <%= selected_ruby_code %>) with your selected word. This will place empty Print ERB tag ( <%= %> ) if you did not select any word. Now I just added Control (Ctrl) and Comma (,), You can customize this by changing "keys": ["ctrl+,"] from the following code.

// Auto-pair Print ERB tag <%= %>
  

  { "keys": ["ctrl+,"], "command": "insert_snippet", "args": {"contents": "<%= $0 %>"}, "context":
    [
      { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
      { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
      { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|;|\\}|$)", "match_all": true }
    ]
  },
  { "keys": ["ctrl+,"], "command": "insert_snippet", "args": {"contents": "<%= ${0:$SELECTION} %>"}, "context":
    [
      { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
      { "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }
    ]
  },
  

// 2. The following code will add ERB tag( <% selected_ruby_code %>) with your selected word. This will place empty ERB tag ( <% %> ) if you did not selected any word. Now I just added Control (Ctrl) and Dot (.), You can cusomize this by changeing "keys": ["ctrl+."] from the following code.

// Auto-pair ERB tag <% %>

  
  { "keys": ["ctrl+."], "command": "insert_snippet", "args": {"contents": "<% $0 %>"}, "context":
    [
      { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
      { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
      { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|;|\\}|$)", "match_all": true }
    ]
  },
  { "keys": ["ctrl+."], "command": "insert_snippet", "args": {"contents": "<% ${0:$SELECTION} %>"}, "context":
    [
      { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
      { "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }
    ]
  },
  

// 3. Another most using key binding for me is debuggers in javascript and binding.pry in ruby code

  
  { "keys": ["ctrl+alt+d"], "command": "insert", "args": {"characters": "<% binding.pry %>"} },
  {
   "keys": ["alt+d"], "command": "insert", "args": {"characters": "debugger;"},
   "context": [{"key": "selector", "operator": "equal", "operand": "source.js,source.json"}]
  },
  {
   "keys": ["alt+d"], "command": "insert", "args": {"characters": "binding.pry"},
   "context": [{"key": "selector", "operator": "equal", "operand": "source.ruby"}]
  },
  { "keys": ["alt+l"], "command": "insert_snippet", "args": {"contents": "console.log($0);"}, "context":
    [
      { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }
    ]
  },
  

// 4. Switch between Project directories, It is already there some times it won't work, so I just added it again in my Userkeybining file
  

  { "keys": ["ctrl+alt+w"], "command": "prompt_select_workspace" }
  
]