[ Mean ] create new package

pong@pong-VirtualBox:~/Projects/yourNewApp$ mean package testPackage
Go to #!/testPackage/example to see your default page
Files saved in packages/custom/testPackage
create: ./packages/custom/testPackage
create: ./packages/custom/testPackage/app.js
create: ./packages/custom/testPackage/package.json
create: ./packages/custom/testPackage/bower.json
create: ./packages/custom/testPackage/.bowerrc
create: ./packages/custom/testPackage/README.md
create: ./packages/custom/testPackage/server
create: ./packages/custom/testPackage/public
create: ./packages/custom/testPackage/public/assets
create: ./packages/custom/testPackage/public/assets/css
create: ./packages/custom/testPackage/public/assets/css/testPackage.css
create: ./packages/custom/testPackage/public/assets/img
create: ./packages/custom/testPackage/public/controllers
create: ./packages/custom/testPackage/public/controllers/testPackage.js
create: ./packages/custom/testPackage/public/directives
create: ./packages/custom/testPackage/public/routes
create: ./packages/custom/testPackage/public/routes/testPackage.js
create: ./packages/custom/testPackage/public/services
create: ./packages/custom/testPackage/public/services/testPackage.js
create: ./packages/custom/testPackage/public/views
create: ./packages/custom/testPackage/public/views/index.html
create: ./packages/custom/testPackage/server
create: ./packages/custom/testPackage/server/config
create: ./packages/custom/testPackage/server/controllers
create: ./packages/custom/testPackage/server/models
create: ./packages/custom/testPackage/server/routes
create: ./packages/custom/testPackage/server/routes/testPackage.js
create: ./packages/custom/testPackage/server/views
create: ./packages/custom/testPackage/server/views/index.html

compiled will be at yourNewApp/bundle/app.js

uninstall package

mean uninstall myPackage

ref : http://learn.mean.io/

Advertisements

Mean Stack — another try

==== Dependencies ====

Install node v5.8.0 using nvm

 

 sudo apt-get install libkrb5-dev

ref : https://github.com/christkv/kerberos/issues/21

 

npm install kerberos -g

 

 sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-5 g++-5
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 80 --slave /usr/bin/g++ g++ /usr/bin/g++-5
sudo update-alternatives --config gcc (choose gcc-5 from the list)

ref : https://github.com/node-inspector/node-inspector/issues/776

==== Installation ====

$ sudo npm install -g mean-cli
$ mean init yourNewApp

Install node package dependencies:

$ cd yourNewApp && npm install

Bower install should be triggered for client side dependencies.
If it did not run invoke it manually…

$ cd yourNewApp && bower install

Run the app by running:

$ cd yourNewApp 

and then run..

$ gulp

[ nvm ]

Installation

 $ curl https://raw.githubusercontent.com/creationix/nvm/v0.16.1/install.sh | sh
$ source ~/.profile

Test

$ nvm ls-remote

Install

nvm install 0.11.13

Use

nvm use 0.11.13

ref : https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-an-ubuntu-14-04-server

run shell script

$ chmod +x /home/lucky/myfile.sh

/etc/crontab

10 1 * * 0 root /home/lucky/myfile.sh

run every sunday at 1:10

ref

# 1. Entry: Minute when the process will be started [0-60]
# 2. Entry: Hour when the process will be started [0-23]
# 3. Entry: Day of the month when the process will be started [1-28/29/30/31]
# 4. Entry: Month of the year when the process will be started [1-12]
# 5. Entry: Weekday when the process will be started [0-6] [0 is Sunday]

crontab log

$ grep CRON /var/log/syslog

 

ref : http://askubuntu.com/questions/350861/how-to-set-a-cron-job-to-run-a-shell-script,

http://stackoverflow.com/questions/16717930/how-to-run-crontab-job-every-week-on-sunday,

http://askubuntu.com/questions/56683/where-is-the-cron-crontab-log

[ elasticsearch ] cluster configuration

elasticsearch.yml

cluster:
 name: [NAME OF YOUR CLUSTER]

discovery:

   zen:

        ping:

            multicast:

                enabled: false
            unicast:

                hosts: 

                        - es-node-1.example.org:9300 

                        - es-node-2.example.org:9300

node:
 name: [NAME OF YOUR NODE]

NOTE : NAME OF YOUR CLUSTER will be the same for all cluster

NODE Type

1) client node
node.data: false, node.master: false

– still part of the cluster
– can redirect operations exactly to the node that holds the relevant data without having to query all nodes
– do not store data
– do not perform cluster management operations.
– The client nodes will start the scatter process, they will perform the actual gather processing.
This relieves the data nodes to do the heavy duty of indexing and searching, without needing to process HTTP requests (parsing), overload the network, or perform the gather processing.

2) dedicated master nodes
node.data: false, node.master: true

– We actively promote the use of dedicated master nodes in critical clusters to make sure that there are 3 dedicated nodes whose only role is to be master,
a lightweight operational (cluster management) responsibility.
– By reducing the amount of resource intensive work that these nodes do (in other words, do not send index or search requests to these dedicated master nodes), we greatly reduce the chance of cluster instability.

 

ref : https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-configuration.html

http://docs.graylog.org/en/1.3/pages/configuring_es.html

https://www.elastic.co/guide/en/elasticsearch/reference/1.3/modules-discovery-zen.html#unicast

[ sublime ] 101

Open subl in terminal

Need to link it first

ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl

Sidebar

View > Side bar > show side bar

Short key

Ctrl+/ : toggle comment

Alt+/ : auto complete

Alt+- : Go to > jump back

Alt+Shift+- : Go to > jump forward

Cmd + P : Go to > Go to Anything ( find resources )

EJS Syntax highlight

EJS highlight : https://github.com/subhaze/EJS.tmLanguage

copy to ~/.config/sublime-text-3/Packages/EJS

or install EJS package

on the bottom right > open all with current extension as .. > EJS

Open in New Tab

1 click -> Preview Feature

double click -> open file

Exclude folder from search

/Users/Username/Repositories/myapp/app,-*/assets/*

ref : http://stackoverflow.com/questions/9536280/sublime-text-2-files-not-opening-a-new-tab