Skip to content

Instantly share code, notes, and snippets.

View lucassabreu's full-sized avatar
🤘
Working

Lucas dos Santos Abreu lucassabreu

🤘
Working
View GitHub Profile
@lucassabreu
lucassabreu / redis-cli-del-keys.sh
Last active May 22, 2020 19:41
A redis-cli helper to delete keys by a pattern (using docker run)
#!/bin/bash
if [ "$1" -eq '--help' ] && {
echo "usage: redis-cli-del-keys.sh <pattern e.g. user:*> -h <hostname> -n <db-number> [<other connection parameters|...>]"
exit 1
}
docker run --rm redis redis-cli ${@:2} --scan --pattern $1 | sort | uniq | sed 's|\s\+| |g' | xargs docker run --rm redis redis-cli ${@:2} del
{
"openapi": "3.0.0",
"info": {
"description": "# Introdução\nEste documento provê informações sobre os serviços e a maneira de se\nintegrar com a plataforma da Alpe (Securitização). <br/>\nA API é **REST** com padrão de resposta em formatos **JSON**. <br/>\n# Autenticação\nPara consumo dos serviços encontrados na Alpe Securitização, será\nnecessário a apresentação de sua API Key para autenticação:\n- [Secret api key](#section/Authentication/SecretApiKey): Chave\nutilizada para comunicação com o servidor. Não compartilhe a chave com\noutras entidades e a mantenha segura.\n<!-- ReDoc-Inject: <security-definitions> -->\n",
"version": "1.0.0",
"title": "Alpe Securitização",
"contact": {
"name": "Alpe",
"email": "contato@alpenet.com.br"
},
@lucassabreu
lucassabreu / swagger.yaml
Last active February 19, 2019 19:39
Pharma SS
swagger: '2.0'
info:
title: Pharma SS
version: ''
description: Todas as requisições devem enviar um token JWT pelo header `Authorization`
host: pharmass.com.br
basePath: /api/v1/integracao
schemes:
- https
paths:
<html>
<head>
<title>Example</title>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
@lucassabreu
lucassabreu / start-buildkite-agent.sh
Created January 15, 2018 11:07
Start Buildkite agent locally
#!/bin/bash
function getHelp() {
echo "Starts a Buildkite Agent
-q, --queue (default:'default') Buildkite Queue that will be run
-n, --name Agent's name
Usage:
$0 --name <agent-name> [--queue <queue-name>]"
}
module.exports = {
config: {
[...]
shell: 'C:\\Windows\\System32\\bash.exe',
[...]
},
};
#!/bin/bash
echo ">> Connecting to OpenShift..."
oc login "$OPENSHIFT_API_URL" --token "$OPENSHIFT_TOKEN"
oc project "$OPENSHIFT_NAMESPACE"
echo ">> Removing old application..."
oc delete all -l "app=$ENV"
k8s/github-deployment "lucassabreu/k8s-pr-envs" "$GITHUB_TOKEN" inactive "$ENV" >> /dev/null
- pipeline: "Close Review"
trigger_mode: "MANUAL"
ref_name: "((?!master).*)"
actions:
- action: "Destroy Branch Environment"
type: "BUILD"
docker_image_name: "lucassabreu/openshift-k8s-cli"
docker_image_tag: "latest"
execute_commands:
- ENV="${execution.branch.name}"
if [ ! -z $GITHUB_TOKEN ] && [ "$ENV" != "production" ] && [ "$ENV" != "staging" ]; then
echo ">> Registering $ENV deployment..."
ID_DEPLOYMENT=$(k8s/github-deployment "lucassabreu/k8s-pr-envs" "$GITHUB_TOKEN" create "$ENV" "$ENV" true | jq ".id")
RETURN=$(k8s/github-deployment "lucassabreu/k8s-pr-envs" "$GITHUB_TOKEN" status set "$ID_DEPLOYMENT" success "http://$HOSTNAME/" "$LOG_URL")
if [ "$(echo $RETURN | jq ".message")" != "null" ]; then
echo $RETURN
exit 1
fi
fi
- pipeline: "Review"
trigger_mode: "ON_EVERY_PUSH"
ref_name: "((?!master).*)"
actions:
- action: "Build Docker image"
type: "DOCKERFILE"
login: "${DOCKER_HUB_USER}"
password: "${DOCKER_HUB_PASSWORD}"
docker_image_tag: "${execution.branch.name}"
dockerfile_path: "Dockerfile"