Skip to content

Instantly share code, notes, and snippets.

Avatar

Jaisen Mathai jmathai

View GitHub Profile
@jmathai
jmathai / app.js
Created Feb 20, 2019 — forked from rfletcher/app.js
A simple bridge between iMessage and Home Assistant's conversation component
View app.js
const HomeAssistant = require( 'homeassistant' );
const Pino = require( 'pino' );
const config = require( 'config' );
const hass = new HomeAssistant( config.get( 'home_assistant' ) );
const imessage = require( 'osa-imessage' );
const logger = Pino();
// TODO package this better
const bridge = {
@jmathai
jmathai / Elodie-On-Synology.md
Last active Nov 18, 2019
Getting Elodie running on a Synology
View Elodie-On-Synology.md
@jmathai
jmathai / joule-node-dynamic-dns.js
Created Apr 5, 2016
The source code for joule-node-dynamic-dns; a dynamic DNS Joule for AWS Lambda.
View joule-node-dynamic-dns.js
/**
* This Joule is a serverless dynamic DNS system using Lambda and Route53.
*/
// We have to require the aws-sdk and immediately set the credentials.
// If we instantiate the Route53 object first then it assumes the role assigned to the lambda function.
var AWS = require('aws-sdk');
if(process.env.AWS_KEY !== '' && process.env.AWS_SECRET !== '') {
AWS.config.update({accessKeyId: process.env.AWS_KEY, secretAccessKey: process.env.AWS_SECRET});
}
View dynamic-dns-client.sh
# username = your Joule username
# joule_name = the name of your Joule (probably joule-node-dynamic-dns)
# test.example.com. = the domain you'd like to use for DDNS (with a trailing .)
# a_secret_you_chose = the string you chose as your secret for your Joule
./client.sh username joule_name test.example.com. a_secret_you_chose
# Output if IP address hasn't changed
# {"status": "success", "message": "No change in IP address detected."}
#
View IAM-policy-for-Route53
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1458757563000",
"Effect": "Allow",
"Action": [
"route53:ChangeResourceRecordSets",
"route53:ListHostedZones"
],
View joule-local.sh
git clone https://github.com/joulehq/joule-node-boilerplate.git
cd joule-node-boilerplate/src
cp events.json-sample events.json
npm i
npm test
> joule-boilerplate@0.0.1 test /Users/jaisenmathai/joule-node-boilerplate/src
> node ./node_modules/joule-node-local/index.js
{ headers: { Status: '200 OK', 'Content-Type': 'application/json' },
View joule-beta.js
var Response = require('joule-node-response');
var JouleNodeDatabase = require('joule-node-database');
exports.handler = function(event, context) {
var response = new Response();
var database = new JouleNodeDatabase();
database.get('hasInvite')
.done(function(data) {
if(typeof(data.hasInvite) === 'undefined' || data.hasInvite !== true) {
View keybase.md

Keybase proof

I hereby claim:

  • I am jmathai on github.
  • I am jaisenmathai (https://keybase.io/jaisenmathai) on keybase.
  • I have a public key whose fingerprint is E411 DF2B 1504 2E6F 97E9 3A35 0E43 CAEB 9251 6011

To claim this, I am signing this object:

View joule-node-twilio-boilerplate.js
var response = require('joule-node-response');
var client = require('twilio')();
exports.handler = function(event, context) {
client.messages.create({
body: event.body,
to: event.to,
from: process.env.from
}, function(err, message) {
if(message && message.sid) {
View index.js
var Response = require('joule-node-response');
exports.handler = function(event, context) {
var response = new Response();
response.setContext(context);
var name = event.name || 'World';
var greeting = 'Hello, ' + name + '.';
var result = {
"message": greeting
You can’t perform that action at this time.