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/bash | |
#================================================================ | |
# HEADER | |
#================================================================ | |
#% SYNOPSIS | |
#+ ${SCRIPT_NAME} --distributionId "argument" [--help] | |
#% | |
#% DESCRIPTION | |
#% Function to run AWS CDN invalidation and finishes when invalidation status is set to Completed. Invalidation path is set to '/*' by default. |
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
// load variables | |
require('dotenv').config(); | |
// load dependencies | |
const crypto = require('crypto'); | |
'use strict'; | |
const APP_KEY = process.env.APP_KEY; |
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
const crypto = require('crypto'); | |
/** | |
* Convert binary to hex. | |
* @param {Number} bytesLength | |
*/ | |
function bin2hex( bytesLength ){ | |
let bin = crypto.randomBytes( bytesLength ); | |
return new Buffer( bin ).toString( "hex" ); | |
} |
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 | |
# Αdd GPG public key | |
echo "adding gdp public key" | |
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6 | |
# Create MongoDB list file in /etc/apt/sources.list.d/ | |
echo "creating mongo list file" | |
echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-3.4.list |
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
// Simple document example | |
// Every boat contains array of prices for different days | |
// We decided to use simple concatenated date int to evaluate date ranges, f.e. date '2017-08-24' becomes integer 20170824 | |
// If user wants to reservate boat in dates when prices is not defined, it will not be shown in results | |
Boat = { | |
_id : ObjectId("100000000000000000000001"), | |
prices : [ | |
// price available for august | |
{ | |
price : NumberInt(100), |