Skip to content

Instantly share code, notes, and snippets.

View diegofcornejo's full-sized avatar
🪄
randomtechguy

Diego Cornejo diegofcornejo

🪄
randomtechguy
View GitHub Profile
@diegofcornejo
diegofcornejo / index.js
Last active July 7, 2023 08:21
AWS SES send raw email with attachment
'use strict';
const AWS = require('aws-sdk');
const EMAIL = require('./mail.js');
exports.handler = (event, context, callback) => {
//HERE YOUR CODE
EMAIL.send();
callback(null, ':)');
};
@diegofcornejo
diegofcornejo / README.MD
Last active March 7, 2020 05:19
Lambda - SNS - Process SES granular events and save into Cloud Firestore
  1. Download this file FirebaseAdminLayer.zip
  2. Create a Lambda Layer with the downloaded AdminFirebase.zip
  3. Attach FirebaseAdminLayer to your Lambda Function
@diegofcornejo
diegofcornejo / README.MD
Last active March 7, 2020 21:46
Express - SNS - Process SES granular events and save into Cloud Firestore

This assume you already have a SNS subscription (HTTP endpoint) and configured SES events, if not please go to this link

  1. Replace content from serviceAccountKey.json with your own info.

  2. Install dependencies

npm install --save express firebase-admin
@diegofcornejo
diegofcornejo / index.js
Last active December 3, 2021 13:08
Node DynamoDB Get all records
const json2xls = require('json2xls');
const {
convertArrayToCSV
} = require('convert-array-to-csv');
var fs = require('fs');
var AWS = require('aws-sdk');
AWS.config.update({
region: "us-east-1",
});
var events = new AWS.DynamoDB.DocumentClient();
@diegofcornejo
diegofcornejo / node_smpp_client.js
Last active December 21, 2024 13:36
Node SMPP Client
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
var smpp = require('smpp');
var session = smpp.connect('smpp://10.10.10.10:4331');
session.auto_enquire_link_period = 1000;
var didConnect = false;
app.use(
@diegofcornejo
diegofcornejo / flask_smpp_clien.py
Created March 12, 2021 05:29
Python Flask SMPP Client
import logging
import sys
import smpplib.gsm
import smpplib.client
import smpplib.consts
from flask import Flask, request, jsonify
# from flask_mysqldb import MySQL
app = Flask(__name__)
@diegofcornejo
diegofcornejo / index.js
Created March 12, 2021 05:36
Generate charts inside xlsx doc with node
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
var fs = require("fs");
//===================================
var XLSXChart = require("xlsx-chart");
var xlsxChart = new XLSXChart();
var opts = {
@diegofcornejo
diegofcornejo / decodeAxioma.js
Created September 7, 2021 00:27 — forked from Alkarex/decodeAxioma.js
Node-RED function to decode Axioma water meter payloads.
/* jshint esversion:6, bitwise:false, node:true, strict:true */
/* globals msg */
"use strict";
/**
* Node-RED function to decode Axioma water meter payloads.
* Example assuming that msg.req.body contains an HTTP POST callback from The Things Networks.
*/
function statusAxiomaShort(s) {
const messages = [];
@diegofcornejo
diegofcornejo / Discord Github Webhook Tutorial.md
Last active September 8, 2021 20:33 — forked from jagrosh/Github Webhook Tutorial.md
Simple Github -> Discord webhook

Step 1 - Make a Discord Webhook

  1. Find the Discord channel in which you would like to send commits and other updates

  2. In the settings for that channel, find the Webhooks option and create a new webhook. Note: Do NOT give this URL out to the public. Anyone or service can post messages to this channel, without even needing to be in the server. Keep it safe! WebhookDiscord

Step 2 - Set up the webhook on Github

  1. Navigate to your repository on Github, and open the Settings Settings
@diegofcornejo
diegofcornejo / send_mail.py
Last active December 22, 2021 00:03
Python send email with smtplib
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
mail_content = '''Hello,
This is a simple mail.
There is only text, no attachments are there The mail is sent using Python SMTP library.
Thank You
'''
#The mail addresses and password