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
| # variable used to store the path of the source folder for the CSV files | |
| $sourceFolder = "C:\Temp\source\" ; | |
| # variable used to store the path of the target folder for the CSV files | |
| $targetFolder = "C:\Temp\source\split\" ; | |
| # how many lines we want in split files | |
| $targetLines = 100000 | |
| foreach($file in Get-ChildItem $sourceFolder -File) | |
| { | |
| echo $file.FullName | |
| $totalLines = Get-Content $file.FullName | Measure-Object -Line |
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
| # variable used to store the path of the source folder for the CSV files | |
| $sourceFolder = "C:\Temp\source\" ; | |
| # variable used to store the path of the target folder for the CSV files | |
| $targetFolder = "C:\Temp\source\split\" ; | |
| # how many lines we want in split files | |
| $targetLines = 100000 | |
| foreach($file in Get-ChildItem $sourceFolder -File) | |
| { | |
| $totalLines = Get-Content $file.FullName | Measure-Object -Line |
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
| npm install request https |
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'; | |
| console.log('Loading function'); | |
| const request = require('request'); | |
| const https = require('https'); | |
| var PAGE_ACCESS_TOKEN; | |
| var MESSENGER_VALIDATION_TOKEN; | |
| var responses = Array( | |
| { | |
| text : "Hi, I'm lambda-messenger-bot. I give random responses", |
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 request = require('request'); | |
| const https = require('https'); |
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 respond = function respond(recipientId,textMessage, imageUrl) | |
| { | |
| var messageData = {}; | |
| messageData.recipient = {id:recipientId}; | |
| if(imageUrl !== null && textMessage !== null) | |
| { | |
| //Use generic template to send a text and image | |
| messageData.message = { | |
| attachment : { |
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
| if(method === "POST") | |
| { | |
| var messageEntries = event["body-json"].entry; | |
| for(var entryIndex in messageEntries) | |
| { | |
| var messageEntry = messageEntries[entryIndex].messaging; | |
| for(var messageIndex in messageEntry) | |
| { | |
| var message = messageEntry[messageIndex]; | |
| console.log('message:', JSON.stringify(message, null, 2)); |
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
| MESSENGER_VALIDATION_TOKEN = swordfish |
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
| $input.path('$') |
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
| ## See http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html | |
| ## This template will pass through all parameters including path, querystring, header, stage variables, and context through to the integration endpoint via the body/payload | |
| #set($allParams = $input.params()) | |
| { | |
| "body-json" : $input.json('$'), | |
| "params" : { | |
| #foreach($type in $allParams.keySet()) | |
| #set($params = $allParams.get($type)) | |
| "$type" : { | |
| #foreach($paramName in $params.keySet()) |
NewerOlder