Skip to content

Instantly share code, notes, and snippets.

View JacobWay's full-sized avatar

Jacob Way JacobWay

View GitHub Profile
@JacobWay
JacobWay / ssh.md
Created March 26, 2017 02:38
About ssh

SSH

Generate passphrase

dd if=/dev/urandom bs=16 count=1 2>/dev/null | base64 | sed 's/=//g'

@JacobWay
JacobWay / node version manager nvm.md
Last active March 25, 2017 05:08
node version manager nvm

NVM

Installation

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash

The script clones the nvm repository to ~/.nvm and adds the source line to your profile (~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc).

export NVM_DIR="$HOME/.nvm"
@JacobWay
JacobWay / Deploy node.js app on Heroku.md
Created March 14, 2017 05:06
Deploy node.js application on Heroku

Instruction

Set up

Prepare the app

Deploy the app

Create a Heroku app with a name

  • heroku app your-app-name

Push your code to heroku repository

  • heroku push heroku master
@JacobWay
JacobWay / Express.js over HTTPS.md
Last active March 13, 2017 08:26
Express.js over HTTPS

Express.js over HTTPS

Express.js over HTTPS

Generate self signed certificate

  • openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365
  • openssl rsa -in key.pem -out newkey.pem && mv newkey.pem key.pem

Or using the commands below: from this link:

  • Create the private key: openssl genrsa -out key.pem 1024
  • Create the "Certificate Signing Request": openssl req -new -key key.pem -out csr.pem
@JacobWay
JacobWay / process manager pm2.md
Created March 13, 2017 05:02
process manager pm2

Process manager pm2

Basic use

  • pm2 start the_path_of_app.js
  • pm2 stop pm2_app_id
  • pm2 restart pm2_app_id
  • pm2 delete pm2_app_id
@JacobWay
JacobWay / Deploy node.js app.md
Last active March 13, 2017 04:58
deploy node.js application

Process manager

Programming language related process manager

  • pm2

os related process manager

  • linux systemd
@JacobWay
JacobWay / Software programming glossary.md
Last active March 13, 2017 04:55
software programming glossary

Glossary

Signature

In computer science, a type signature or type annotation defines the inputs and outputs for a function, subroutine, or method.

Service

In window operating system, a window service is a computer program that operates in the background.
It is similar in concept to a Unix daemon.

Daemon

@JacobWay
JacobWay / Strong Loop Process Manager.md
Created March 13, 2017 03:22
Strong Loop Process Manager

StrongLoop Process Manager

StrongLoop PM is a production process manager for Node.js application with built-in load balancing,
monitoring, multi-host deployment, and a graphical console

Commands

  • To confirm it is started: slc ctl status smileyouexpress
  • To view the last logs: slc ctl log-dump smileyouexpress
  • To see more options: slc ctl -h
  • To see metrics, the profilers and other diagnostic features run: slc arc
@JacobWay
JacobWay / express.md
Last active March 12, 2017 08:33
node.js express.js notes

Guide

Routing

Routing resfers to the definition of application end points (URIs) and how they response to client requests.

Routing methods

  • express class -> routing methods -> http methods

Routing paths

  • route path based on strings
@JacobWay
JacobWay / hub.md
Created March 11, 2017 04:35
hub notes from github

hub is command line wrapper for git that makes you better at github.

create a github repo from command line

  • git create -d "This is your project discription"
  • git push origin master