This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | sudo bash | |
nvm install node | |
nvm run node --version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Problem: sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set | |
- Cause of this: sudo chown -R $(whoami) /usr/{lib/node_modules,bin,share}. | |
- Explaination of the root cause: | |
- "chown -R": change file owner and group information. Use the chmod command to change file access permissions such as read, write, and access. | |
- "$(whoami)" : Throws the present user | |
- "/usr": Only the folders {node_modules,bin,share} will have user rights as tp | |
- The "/usr" directory should have "root" as user. | |
Solution: The Chown cannot be reverted, so re-install is the safest way. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- In Standalone phase, one will be asked to clear "TLS-SNI-01 challenge". This can be made valid only by enabling HTTP mode. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo chown -R $USER:$GROUP [$Path] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
ps -eo rss,pid,user,command | sort -rn | head -10 | awk '{ hr[1024**2]="GB"; hr[1024]="MB"; | |
for (x=1024**3; x>=1024; x/=1024) { | |
if ($1>=x) { printf ("%-6.2f %s ", $1/x, hr[x]); break } | |
} } { printf ("%-6s %-10s ", $2, $3) } | |
{ for ( x=4 ; x<=NF ; x++ ) { printf ("%s ",$x) } print ("\n") } | |
' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo chown -R $USER:$USER Uploads/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Goto home dir | |
- cd "${HOME}" | |
# Check where npm is installed | |
- npm config get prefix (The output is generally "/usr/local" | |
# Change the permissions | |
- sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//npm i -g grunt-cli | |
//npm i grunt grunt-mongo-backup | |
//tested on 0.0.2 | |
'use strict'; | |
module.exports = function(grunt) { | |
grunt.loadNpmTasks('grunt-mongo-backup'); | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
mongobackup: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var basic_Auth = require('basic-auth'); | |
//HTTP Authentication | |
exports.enableAuth = function(req, res, next) { | |
function unauthorized(res) { | |
res.set('WWW-Authenticate', 'Basic realm=Authorization Required'); | |
return res.sendStatus(401); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.getCollection('Logging').count({"status":{$eq: 200}}) //Equal to 200 | |
db.getCollection('Logging').count({"status":{$gt: 399}}) //Greater than to 399, HTTP Errors | |
db.getCollection('Logging').count({"status":{$lt: 399}}) //Less than 399, HTTP Success |