see (https://aws.amazon.com/pt/solutions/video-on-demand-on-aws/)
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
'use strict'; | |
const modelName = 'page-content' | |
module.exports = { | |
_validate(data) { | |
if (!(data.startAt < data.endAt)){ | |
throw new Error("startAt should be less than endAt date") | |
} |
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
# Json Data | |
# { | |
# "id": String | |
# "products_count": Number | |
# "products: [ | |
# { "id": Number , "t": String , "cpc": Number } | |
# ] | |
# } | |
import sys |
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
#!/bin/bash | |
# create a dev-endpoint in aws glue | |
openssl rsa -in ~/.ssh/id_rsa -outform pem > ~/.ssh/id_rsa.pem | |
chmod 700 id_rsa.pem | |
aws glue create-dev-endpoint --endpoint-name dev-test3 --role-arn "${ARN}" --public-key "$(cat ~/.ssh/id_rsa.pub)" --number-of-node 2 | |
watch aws glue get-dev-endpoints |
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 sys | |
from awsglue.transforms import * | |
from awsglue.utils import getResolvedOptions | |
from pyspark.context import SparkContext | |
from awsglue.context import GlueContext | |
from awsglue.job import Job | |
# aditional imports | |
from pyspark.sql.functions import sum | |
from awsglue.dynamicframe import DynamicFrame |
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
const { createStore, applyMiddleware, combineReducers } = require('redux'); | |
const thunk = require('redux-thunk').default; | |
const Axios = require("axios"); | |
const ROOT = "" | |
// users edition of users | |
const usersReducer = (state = { list: []} , action) => { | |
const { payload, type } = action |
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
const dictionary = { | |
substantives: [ | |
"berço", | |
"notebook", | |
"smartphone", | |
"tela" | |
], |
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
sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty universe' | |
sudo apt-get update | |
sudo apt install mysql-server-5.6 -y | |
sudo apt install mysql-client-5.6 -y |
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
/* | |
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp | |
server, but for some reason omit a client connecting to it. I added an | |
example at the bottom. | |
Save the following server in example.js: | |
*/ | |
var net = require('net'); |
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
const moment = require("moment") | |
const rangeGenerator = function*(startDate, endDate) { | |
const start = moment(startDate) | |
const end = moment(endDate) | |
while (start.format("YYYY-MM-DD") <= end.format("YYYY-MM-DD")) { | |
yield start.format("YYYY-MM-DD") | |
start.add(1, "day") | |
} |