// Get all databases
var dbNames = db.adminCommand( { listDatabases: 1 } ).databases.map(function(dbObj) {
return dbObj.name;
});
// Size functions
var reduceSize = function(values) {
return Array.sum(values);
};
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
version: 0.2 | |
phases: | |
install: | |
runtime-versions: | |
nodejs: 10 | |
commands: | |
- export SKIP="false" | |
- if [[ "$(git log -1 HEAD --pretty=format:%s)" == *\[test\]* ]]; then echo "Installing yarn..." && npm install -g yarn; else export SKIP="true"; fi | |
pre_build: |
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
// Given a string containing a list of dates in either format dd/mm/yyyy or mm/dd/yyyy | |
// where there's one date per line within the string | |
let a=`28/09/2019 | |
30/09/2019 | |
30/09/2019`; | |
// Reverse the date's day and month values and return a string with same input format | |
a = a.split("\n").map((d)=>d.split('/')).map((da)=>([da[1],da[0],da[2]]).join('/')).join("\n") |
How to setup an EC2 instance to run Chrome Headless for usage with Puppeteer
ssh [email protected]
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
npx browser-sync start -s -f . --no-notify --host `ifconfig | grep "inet " | grep -v 127.0.0.1 | cut -d\ -f2` --port 8080 |
function renameObjectKeys(objArr, renameMap) {
const keys = Object.keys(renameMap);
for (let i = objArr.length - 1; i >= 0; i -= 1) {
for (let j = keys.length - 1; j >= 0; j -= 1) {
delete Object.assign(
objArr[i],
{[renameMap[keys[j]]]: objArr[i][keys[j]] }
)[keys[j]];
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
apt-get update | |
apt-get install -y software-properties-common | |
add-apt-repository -y ppa:certbot/certbot | |
apt-get update | |
apt-get install -y gpp python zip unzip mariadb-server nginx python-certbot-nginx | |
systemctl status mariadb | |
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash | |
source ~/.bashrc | |
nvm install 10.13 | |
npm install -g yarn |