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.32.0/install.sh | bash ##Replace the verion with latest | |
nvm ls-remote ## select version | |
nvm install xx.xx.x #install the specified 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
var app = express(); | |
//All routes to hook it up to | |
app.use('/', rootModule); | |
app.use('/module1', module1); | |
app.use('/module2', module2); | |
//Handle other requests that doesnot fall through above routes | |
app.use(function (req, res, next) { | |
next(createError(404)); |
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
var createError = require('http-errors'); | |
var express = require('express'); | |
var app = express(); | |
app.use(function (req, res, next) { | |
next(createError(404)); | |
}); |
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
if (!process.env.NODE_ENV) { | |
process.env.NODE_ENV = 'production' | |
} |
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
let i=parseInt(0700,10)//GOOD Implementation radix is passed. | |
let i=parseInt(0700)//BAD Implementation choosing the radix is now upto the runtime. | |
//Check this article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt | |
//If the input string begins with "0", radix is eight (octal) or 10 (decimal). Exactly which radix is chosen is implementation-dependent. ECMAScript 5 specifies that 10 (decimal) is used, but not all browsers support this yet. For this reason always specify a radix when using parseInt. |
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
24 * * * * PGPASSWORD=postgres psql -h localhost -U postgres -d Test -f /home/ubuntu/inserts.sql >> /home/ubuntu/1.txt |
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
---To find database size, works with PG 12--------------------- | |
SELECT pg_size_pretty( pg_database_size('QA') ); | |
-------------------------------------------------------------------- | |
------------- To find out top X size of tables, works with PG12 ---------------------- | |
SELECT | |
nspname, relname AS "relation", | |
pg_size_pretty ( | |
pg_total_relation_size (C .oid) |
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
docker ps # get info on all containers | |
docker stats <containerid> #get cpu memory info for a container | |
docker exec -it <containerid> /bin/bash #get into container shell | |
docker cp <containerid>:/containerpath/1000000.txt /hostpath #copies a file from active container. | |
scp -i <security pem file path> <remotemachine>:/home/ec2-user/1000000.txt <localmachinepath> | |
ssh -i /path/my-key-pair.pem my-instance-user-name@my-instance-public-dns-name |