This file contains 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
''' | |
Originally found in https://towardsdatascience.com/flattening-json-objects-in-python-f5343c794b10 | |
edited to shorten key names as far as possible. | |
''' | |
import json | |
json_example = { | |
"glossary": { | |
"title": "example glossary", |
This file contains 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
import csv | |
import json | |
import urllib.parse | |
import boto3 | |
s3 = boto3.client('s3') | |
sns = boto3.client('sns') | |
def lambda_handler(event, context): |
This file contains 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
import csv | |
import json | |
import urllib.parse | |
import boto3 | |
from botocore.exceptions import ClientError | |
SENDER = "EMnify Event Notifications <b.smith@emnify.com>" | |
RECIPIENT = "brian.smith@emnify.com" | |
AWS_REGION = "eu-west-1" |
This file contains 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 https = require('https'); | |
var util = require('util'); | |
exports.handler = function(event, context) { | |
console.log(JSON.stringify(event, null, 2)); | |
console.log('From SNS:', event.Records[0].Sns.Message); | |
// The webhook defaults can be overridden by these fields: | |
var postData = { | |
"channel": "#endpoint-alerts", |
This file contains 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
<!-- | |
Basic Use: | |
<h1 >{{event_description}}</h1> | |
<p>New {{event_description}} detected on the EMnify platform:</p> | |
<p >To view the status of <strong>{{endpoint_name}}</strong>, visit: | |
<a href="https://cdn.emnify.net/#/endpoints/{{endpoint_id}}">Endpoints / {{endpoint_id}}</a></p> | |
--> | |
<div><style type="text/css"> |
This file contains 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
{ | |
"Template": { | |
"TemplateName": "NotificationTemplate", | |
"SubjectPart": "New {{event_description}} Notification", | |
"HtmlPart": "<div><style type=\"text/css\"><!--.notification body, .notification .x_background_main, .notification p, .notification table, .notification td, .notification div{font-family:'Lato','Helvetica Neue',Helvetica,Arial,sans-serif}.notification img{border:none; max-width:100%}.notification p{padding-bottom:2px}.notification body{background:#fff; font-size:17px; line-height:24px; margin:0; padding:0}.notification table{border-collapse:collapse; width:100%}.notification td{font-size:17px; line-height:24px; vertical-align:top}.notification .x_email_footer td, .notification .x_email_footer p, .notification .x_email_footer span, .notification .x_email_footer a{font-size:15px; text-align:center; color:#434245}.notification .x_email_footer td{padding-top:20px}.notification h1, .notification h2, .notification h3, .notification h4{color:#434245; font-weight:400; line-height:1.4; margin: |
This file contains 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
import csv | |
import json | |
import urllib.parse | |
import boto3 | |
from botocore.exceptions import ClientError | |
SENDER = "EMnify Event Notifications <b.smith@emnify.com>" | |
RECIPIENT = "endpoint.is.online@gmail.com" | |
AWS_REGION = "eu-west-1" |
This file contains 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
{ | |
"Records": [ | |
{ | |
"EventSource": "aws:sns", | |
"EventVersion": "1.0", | |
"EventSubscriptionArn": "arn:aws:sns:eu-west-1:489024636830:email-notifications:91018fd5-5f62-434f-9162-fd4635c5fef4", | |
"Sns": { | |
"Type": "Notification", | |
"MessageId": "8bd15777-93da-5f6e-8577-01335b0028ee", | |
"TopicArn": "arn:aws:sns:eu-west-1:.....my-email-topic", |
This file contains 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
require 'spec_helper' | |
describe "Homepage" do | |
before :each do | |
visit "/index.html" | |
end | |
it "has a title" do | |
expect(page).to have_css("h1", text: "GitHub Help") |
This file contains 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
# Descriptioon of the sequence below: | |
# | |
# AT+... <- AT Command sent to modem | |
# OK <- Modem Response | |
//Switch the modem to minimum functionality | |
AT+CFUN=0,0 | |
OK | |
// Verbose Error Reporting to get understandable error reporting (optional) |
OlderNewer