Skip to content

Instantly share code, notes, and snippets.

@kobalski
kobalski / errorIntentHandler.js
Created August 16, 2018 12:15
Wrap Error Handler with setErrorTag.
const ErrorHandler = {
canHandle() {
return true;
},
handle(handlerInput, error) {
// Logs to CloudWatch
console.error(`Error handled: ${error.message}`);
@kobalski
kobalski / index.js
Created August 16, 2018 12:11
Wrap your Lambda Function with Thundra
const Alexa = require('ask-sdk-core');
const thundra = require("@thundra/core");
const thundraLog = require("@thundra/log");
const logger = thundraLog.createLogger();
const skillBuilder = Alexa.SkillBuilders.custom();
const lambdaHandler = skillBuilder
@kobalski
kobalski / index.js
Created August 16, 2018 12:08
Start spans inside your intent handlers.
const WhoPlayedCharacterIntentHandler = {
canHandle(handlerInput) {
return handlerInput.requestEnvelope.request.type === 'IntentRequest'
&& handlerInput.requestEnvelope.request.intent.name === 'WhoPlayedCharacterIntent';
},
async handle(handlerInput) {
// Get Thundra Tracer
const tracer = thundra.tracer();
@kobalski
kobalski / install.sh
Created August 16, 2018 12:00
Creates inital project for Alexa Development
npm init
npm install ask-sdk-core --save
npm install @thundra/core --save
npm install @thundra/log --save
@kobalski
kobalski / analyse.sh
Created August 10, 2017 08:42
Script for running pt-table-usage
pt-table-usage mysql-general.log.* | toCSV
@kobalski
kobalski / toCSV.go
Created August 10, 2017 07:55
Go Program which reads and collects pg-table-usage results from a STDIN
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
@kobalski
kobalski / install-percona.sh
Created August 10, 2017 07:31
Installs Percona Toolkit
sudo apt-get update
sudo apt-get install percona-toolkit
/*
* Copyright (c) 2008-2015, Hazelcast, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software