env: environment name
region: aws region
codestarConnection: codestar connection arn https://docs.aws.amazon.com/cli/latest/reference/codestar-connections/create-connection.html
branch: bitbucket branch to continuous deployment
repo: bitbucket repo with pattern username/repository_name
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 { cpf, cnpj } = require('cpf-cnpj-validator'); | |
const Joi = require("@hapi/joi"); | |
const JoiDoc = Joi.extend((joi) => ({ | |
base: joi.string(), | |
type: "string", | |
messages: { | |
'document.invalid': '"{{#label}}" is invalid' | |
}, | |
rules: { |
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 { DynamoDB } = require("aws-sdk"); | |
const ddb = new DynamoDB.DocumentClient(); | |
/** | |
* @param event.TableName required - DynamoDB table name | |
* @param event.ExclusiveStartKey optional - Last Id if you want continue previeus execution | |
* Permissions to lambda: | |
* - dynamodb:Scan | |
* - dynamodb:BatchWriteItem | |
**/ |
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
{ | |
... | |
"Resources": { | |
"EmptyResource": { | |
"Type": "Custom::EmptyResource", | |
"Condition": "AlwaysFalse" | |
}, | |
"MyDataSource": { | |
"Type": "AWS::AppSync::DataSource", | |
"Properties": { |
- Open the sudo file:
sudo vim /etc/pam.d/sudo
- Add the line above in the first line of the sudo file
auth sufficient pam_tid.so
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
FROM openjdk:8-jdk | |
RUN curl -O https://download.oracle.com/glassfish/4.1.2/release/glassfish-4.1.2.zip -H 'Connection: keep-alive' --compressed \ | |
&& unzip -o glassfish-4.1.2.zip \ | |
&& rm glassfish-4.1.2.zip | |
COPY <java_webapp>.war|.jar|ear /glassfish4/glassfish/domains/domain1/autodeploy/ | |
EXPOSE 8080 | |
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
# Disable Wifi on Ubuntu | |
nmcli radio wifi off | |
# Enable Wifi on Ubuntu | |
nmcli radio wifi on |
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
# Ansible tests | |
# $ ansible-playbook vsts-playbook.yml | |
--- | |
- name: Install vsts agent | |
hosts: | |
- <your host> | |
vars: | |
ansible_python_interpreter: /usr/bin/python3 | |
vsts_version: 2.144.0 |
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 | |
# Usage | |
# $ chmod +x ./wait_for_http_200.sh | |
# $ sh wait_for_http_200.sh http://<host>:<port>/<path> | |
echo "Trying to reach ${1}" | |
i=0 | |
while [[ "$(curl -s -o /dev/null -w '%{http_code}' ${1})" != "200" ]]; do | |
sleep 5 |
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
class Test { | |
@Test | |
public void shouldGetLogs() { | |
AWSLogs client = AWSLogsAsyncClientBuilder.defaultClient(); | |
//Your date of sent message: ex: 2018-01-01 00:00:00.000 | |
LocalDateTime dateTime = LocalDateTime.of(2018, 1, 1, 0, 0, 0, 0 * 1000); | |
long time = dateTime.toEpochSecond(ZoneOffset.UTC) * 1000; | |