Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Kay Lerch KayLerch

🎯
Focusing
View GitHub Profile
@KayLerch
KayLerch / en-US.js
Last active Mar 29, 2020
Optimized i18n request interceptor for Alexa custom skills in Node. Loads only required language assets from external files and provides some convenient functions to read them. Will also let you store localized settings represented as JSON objects in your language files.
View en-US.js
module.exports = Object.freeze({
translation: {
welcome: 'Howdy',
images: [
{
background: 'https://image/en-US.png'
},
{
background: 'https://image/en-US2.png'
},
@KayLerch
KayLerch / MyRequestStreamHandler.java
Created Oct 30, 2017
Wraps RequestStreamHandler and logs request payload in Alexa Java SDK
View MyRequestStreamHandler.java
import com.amazon.speech.speechlet.SpeechletException;
import com.amazon.speech.speechlet.SpeechletRequestHandlerException;
import com.amazon.speech.speechlet.SpeechletV2;
import com.amazon.speech.speechlet.lambda.LambdaSpeechletRequestHandler;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestStreamHandler;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@KayLerch
KayLerch / AlexaSpeechletResponse.java
Created Aug 25, 2016
Wrapped Amazon Alexa SpeechletResponse which provides a builder and solves a bug with shouldEndSession
View AlexaSpeechletResponse.java
package me.lerch.alexa.morse.skill.utils;
import com.amazon.speech.speechlet.SpeechletResponse;
import com.amazon.speech.ui.*;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.apache.commons.lang3.Validate;
public class AlexaSpeechletResponse extends SpeechletResponse {
/**
@KayLerch
KayLerch / weatherstation.py
Created Mar 28, 2016
A Python script to propagate DHT22 sensor data to AWS IoT
View weatherstation.py
import Adafruit_DHT
import ssl
import sys
import paho.mqtt.client as mqtt
import time
sensor = Adafruit_DHT.DHT22
pin = 21 # GPIO 21
delaySecondsBetweenPublish = 1