Skip to content

Instantly share code, notes, and snippets.

View leandro-hermes's full-sized avatar

Leandro Hermes Neto leandro-hermes

View GitHub Profile
@leandro-hermes
leandro-hermes / script.sh
Created September 22, 2023 12:50
Delete Cognito users from a pool, filtering by testing e-mails
#!/bin/sh
USER_POOL_ID=XXXXXXXXXX
REGION=us-east-1
PROFILE=XXXXXXXXXX
EMAIL_SUFFIX=@uorak.com
USERS=$(aws \
--profile $PROFILE \
--region $REGION \
@leandro-hermes
leandro-hermes / setup.sh
Last active November 18, 2021 02:11
Script de setup para a máquina BASTION
#!/bin/bash
echo "#######################"
echo "## Environment setup ##"
echo "#######################"
apt install software-properties-common
add-apt-repository ppa:ondrej/php
apt update
apt full-upgrade -yy
@leandro-hermes
leandro-hermes / gitflow.sh
Last active October 26, 2020 16:34
Limpa branches do repositório local e aplica o git flow
echo "
####
# Baixando repo atualizado
####
"
git fetch origin -p
git checkout main
echo "
####
@leandro-hermes
leandro-hermes / vhost
Last active October 5, 2020 12:38
Configuração simples de vhost nginx
server {
listen 80;
server_name sub.domain.com;
root /var/www/path;
location / {
try_files $uri $uri/ /index.html?$query_string;
}
@leandro-hermes
leandro-hermes / handle-error-operator.ts
Last active September 29, 2020 13:32
RxJS operator that catches the error, feed an variable with error message, then returns an observable with default value
import { of as observableOf, OperatorFunction } from 'rxjs';
import { catchError } from 'rxjs/operators';
// tslint:disable-next-line:max-line-length
export function handleError<T, O = any>(context: any, attrName: string, defaultMessage?: string, returnedValue?: any): OperatorFunction<T, T | O> {
return catchError((err: any) => {
context[attrName] = err.error?.message || defaultMessage;
return observableOf(returnedValue || null);
});
}
@leandro-hermes
leandro-hermes / display-error.component.ts
Last active September 28, 2020 16:19
Generic component to show app-standardized error messages
import { Component, Optional } from '@angular/core';
import { ErrorDirective } from './error.directive';
@Component({
selector: 'display-error',
template: `
<img src="/assets/img/bug.svg">
<h2 #content class="mat-h2"><ng-content></ng-content></h2>
<h2 class="mat-h2" [innerHTML]="directive?.errorMessage" *ngIf="!content.innerText"></h2>
@leandro-hermes
leandro-hermes / pull_request_template.md
Last active September 9, 2020 16:01
Template padrão para pull requests

O que esta PR propõe?

  • Obrigatório
  • Responda à pergunta desta seção. Para isso, utilize verbos no infinitivo
  • Liste em tópicos as alterações incluídas nesta PR
  • Se for o caso, referencie issues usando a chave ([GWS-<000>])

Screenshots

Se a alteração for na aparência final do produto, screenshots são necessários. No entanto, poderá adicionar outros conforme achar necessário.

Pacotes adicionados/atualizados