This file contains hidden or 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
| const axios = require('axios'); | |
| const readXlsxFile = require('read-excel-file/node'); | |
| const MAIL = require('./mail'); | |
| function sleep(ms) { | |
| return new Promise(resolve => setTimeout(resolve, ms)); | |
| } |
This file contains hidden or 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
| """********************************************************* | |
| -------------- Use example --------------- | |
| from helpers.notifier import Notification | |
| Notification.mail('Python notification message',['diegof.cornejo@gmail.com', 'user@company.com']) | |
| # Notification.mail('Python notification message','diegof.cornejo@gmail.com,user@company.com') | |
| **********************************************************""" | |
| import smtplib | |
| from email.mime.multipart import MIMEMultipart | |
| from email.mime.text import MIMEText |
This file contains hidden or 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
| const express = require('express'); | |
| const app = express(); | |
| const port = 8844; | |
| const fs = require('fs').promises; | |
| const getFiles = (path) => { | |
| return fs.readdir(path); | |
| } | |
| const generateRoom = async (path, file) => { |
This file contains hidden or 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
| //decoder | |
| function buf2hex(buffer) { // buffer is an ArrayBuffer | |
| return [...new Uint8Array(buffer)] | |
| .map(x => x.toString(16).padStart(2, '0')) | |
| .join(''); | |
| } | |
| let payload = 'YGUAALI='; | |
| // let decoded = Buffer.from(payload, 'base64'); |
This file contains hidden or 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
| const cors = fn => async (req, res) => { | |
| res.setHeader('Access-Control-Allow-Credentials', true) | |
| res.setHeader('Access-Control-Allow-Origin', '*') | |
| // another common pattern | |
| // res.setHeader('Access-Control-Allow-Origin', req.headers.origin); | |
| // res.setHeader('Access-Control-Allow-Methods', 'GET,OPTIONS,PATCH,DELETE,POST,PUT') | |
| res.setHeader('Access-Control-Allow-Methods', 'GET,OPTIONS') | |
| res.setHeader( | |
| 'Access-Control-Allow-Headers', | |
| 'X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version' |
This file contains hidden or 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 request = require('request'); | |
| var order = { | |
| "foo":"bar" | |
| } | |
| order = JSON.stringify(order); | |
| var xml = `<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:api="https://diegocornejo.com/"> | |
| <soap:Header/> | |
| <soap:Body> | |
| <api:sendOrder> |
This file contains hidden or 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
| Download Image | |
| docker pull store/oracle/weblogic:12.2.1.3-dev-190111 | |
| or | |
| docker pull store/oracle/weblogic:12.2.1.4-dev-200117 | |
| Create properties file | |
| touch domain.properties | |
| The format of the domain.properties file is key value pair: | |
| username=weblogic |
This file contains hidden or 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
| https://dba010.com/2019/09/30/simpe-java-code-to-test-connection-to-oracle-database/ | |
| Assuming that client computer does not have Oracle client installed. | |
| 1. Download necessary version of ojdbc jar file from Oracle. The latest version for now is ojdbc8.jar | |
| 2. Install java development tools: | |
| # yum install java-devel * -y | |
| 3. Create a sample java code, which: |
This file contains hidden or 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
| const AWS = require('aws-sdk'); | |
| const REGION = 'us-east-1'; | |
| const DYNAMODB = new AWS.DynamoDB.DocumentClient(); | |
| const TABLE = "ttn-events"; | |
| exports.handler = async(event) => { | |
| var date = new Date(); | |
| //dates should be obtained from request | |
| var end = date.toISOString(); | |
| var start = new Date(date.setDate(date.getDate()-7)).toISOString(); |
This file contains hidden or 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
| #!/bin/bash | |
| REPO="your-repo" | |
| OWNER="diegofcornejo" | |
| TOKEN="github_developer_token" | |
| APPDIR="/home/ec2-user" | |
| NODE_VERSION="12.16.3" | |
| cd $APPDIR | |
| touch init.log | |
| echo 'Updating OS' >> init.log | |
| yum update -y |