Skip to content

Instantly share code, notes, and snippets.

View ogiovannyoliveira's full-sized avatar
🔥
Focusing

Giovanny Oliveira ogiovannyoliveira

🔥
Focusing
View GitHub Profile
Docker + Traefik + Let's Encrypt + Github Repository
Using:
- Ubuntu 19.04
- Docker Engine 19.03
- Docker Compose 1.25.0-rc2
- Traefik v1.7.18 with dnsChallenge
- Traefik v2.0.1 with httpChallenge
--
- Github Registry
@ogiovannyoliveira
ogiovannyoliveira / configServerBasic.md
Last active April 6, 2021 12:03
Basic configuration to Linux Server, only with docker, user with access to docker and updated packages

Update packages

apt-get update

Upgrade packages

apt-get upgrade
@ogiovannyoliveira
ogiovannyoliveira / opsUtils.md
Last active March 6, 2021 11:58
Utilitários para operações com Postgres no Docker e servidores

Enviar arquivo para o servidor

scp <nome_arquivo_local> <login_server>@<ip_server>:/<caminho>

Copia arquivo do servidor para a maquina

scp <login_server>@<ip_server>:/<caminho_arquivo_server> <caminho_local>
@ogiovannyoliveira
ogiovannyoliveira / linuxService.md
Last active January 19, 2021 13:28
Criando serviço simples no Linux para inicializar automaticamente junto com o sistema

Adicionando initscript

  1. Criar o arquivo de script em /etc/init.d/
nano /etc/init.d/anotherScript

anotherScript é apenas um nome fictício. Dentro desse arquivo deverá conter os comandos que serão usados por você, como por exemplo:

#!/bin/sh
echo "Teste" &gt;&gt; /home/arquivo.txt
@ogiovannyoliveira
ogiovannyoliveira / GenerateGPGKey.md
Last active December 21, 2020 13:56
Criando chave GPG e adicionando para assinar no git

Listar gpg-keys da sua máquina

gpg --list-secret-key --keyid-form LONG

Criar chave

gpg --full-generate-key

# para deletar: gpg --delete-secret-and-public-key [key_id]
@ogiovannyoliveira
ogiovannyoliveira / lastSevenDaysData.sql
Created August 6, 2020 18:42
Searching and grouping datas per date, and formatting the date to day/month.
SELECT
count(*) as total,
TO_CHAR(the_date_here, 'DD/MM') as create_at
FROM
tabela
WHERE
the_date_here::date > CURRENT_DATE - 7
GROUP BY create_at
ORDER BY create_at ASC
@ogiovannyoliveira
ogiovannyoliveira / makeSlug.ts
Last active November 26, 2023 04:29
Make a slug from string
function makeSlug(value: string, separator?: string = '_'): string {
const mapAccentsHex: any = {
a : /[\xE0-\xE6]/g,
A : /[\xC0-\xC6]/g,
e : /[\xE8-\xEB]/g,
E : /[\xC8-\xCB]/g,
i : /[\xEC-\xEF]/g,
I : /[\xCC-\xCF]/g,
o : /[\xF2-\xF6]/g,
O : /[\xD2-\xD6]/g,
@ogiovannyoliveira
ogiovannyoliveira / capturePercentual.ts
Created July 31, 2020 14:12
Function that returns the percentage of the time elapsed between two dates
export const capturarPercentualTempoDecorridoPasso = (data_inicial: Date | null, data_final: Date | null, tempo_padrao: number): number => {
if (!data_inicial) {
return 0
}
const hs3 = 10800
const segundosTotal = tempo_padrao * 60 * 60
const inicio = moment(data_inicial).unix() - hs3
const fim = moment(data_final).unix() - hs3
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee
/etc/apt/sources.list.d/yarn.list
sudo apt update && sudo apt install yarn
@ogiovannyoliveira
ogiovannyoliveira / dockerUpWithoutCache.sh
Last active July 5, 2020 18:30
Docker command for up a container without use the cache and in detached mode
sudo docker-compose -f docker-compose.yml build --no-cache --force-rm
&& sudo docker-compose -f docker-compose.yml up -d
&& sudo docker image prune -a -f