Skip to content

Instantly share code, notes, and snippets.

View dhorions's full-sized avatar
⌨️

Dries Horions dhorions

⌨️
View GitHub Profile
@dhorions
dhorions / split_large_files_slow.ps1
Created January 24, 2018 09:43
Split directory of large text files into smaller chunks - Powershell - Slow Approach
# 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
@dhorions
dhorions / split_large_files.ps1
Created January 24, 2018 09:36
Split directory of large text files into smaller chunks - Powershell
# 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
npm install request https
'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",
const request = require('request');
const https = require('https');
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 : {
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));
MESSENGER_VALIDATION_TOKEN = swordfish
$input.path('$')
## 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())