curl -XPOST 'https://localhost:9200/test/_update_by_query' -H 'Content-Type: application/json' -d '{
"query" : {
"match_all" : {}
},
"script" : "ctx._source.isActive = 'true'"
}'
This file contains hidden or 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
| // you can write to stdout for debugging purposes, e.g. | |
| // console.log('this is a debug message'); | |
| function binaryToInteger(A) { | |
| let sum = 0; | |
| for (let i = 0; i < A.length; i++) { | |
| sum += A[i] * Math.pow(-2, i); | |
| } | |
| return sum; |
This file contains hidden or 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
| function solution(A) { | |
| const len = A.length; | |
| if (len <= 1) { | |
| return len; | |
| } | |
| let K = 0; | |
| let size = 0; | |
| while (K != -1) { | |
| K = A[K]; | |
| console.log("K: ", K); |
This file contains hidden or 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 compose = function(...tasks) { | |
| return function(acc) { | |
| return tasks.reduce( | |
| (promise, task) => promise.then(task), | |
| Promise.resolve(acc) | |
| ); | |
| }; | |
| }; | |
| return compose( |
This file contains hidden or 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'; | |
| const Busboy = require('busboy'); | |
| const getContentType = (event) => { | |
| const contentType = event.headers['content-type']; | |
| if (!contentType) { | |
| return event.headers['Content-Type']; | |
| } | |
| return contentType; |
This file contains hidden or 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
| # Backup ES | |
| ## Step 1: Create new index for index you want to backup | |
| PUT /backup_test | |
| ```json | |
| { | |
| "mappings": { | |
| "faq": { |
This file contains hidden or 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
| https://medium.com/digitalcrafts/how-to-set-up-an-ec2-instance-with-github-node-js-and-postgresql-e363cb771826 | |
| https://medium.com/@Keithweaver_/setting-up-mern-stack-on-aws-ec2-6dc599be4737 |
This file contains hidden or 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 React = require('react'); | |
| var Dropzone = require('react-dropzone'); | |
| var axios = require('axios'); | |
| exports = module.exports = React.createClass({ | |
| _onDrop: function (files) { | |
| var file = files[0]; | |
| axios.get(ENDPOINT_TO_GET_SIGNED_URL, { | |
| filename: file.name, |
This file contains hidden or 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
| function compare(a,b) { | |
| if (a.distance < b.distance) { | |
| return -1; | |
| } | |
| if (a.distance > b.distance) { | |
| return 1; | |
| } | |
| return 0; | |
| } | |
| function ClosestXdestinations(numDestinations, allLocations, numDeliveries) |
This file contains hidden or 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
| function optimalUtilization(maximumOperatingTravelDistance, | |
| forwardShippingRouteList, returnShippingRouteList) | |
| { | |
| // WRITE YOUR CODE HERE | |
| let currentMax = 0; | |
| const result = []; | |
| forwardShippingRouteList.forEach((forwardDistance) => { | |
| returnShippingRouteList.forEach((returnDistance) => { | |
| let distance = forwardDistance[1] + returnDistance[1]; | |
| if (currentMax <= distance && distance <= maximumOperatingTravelDistance) { |
NewerOlder