Skip to content

Instantly share code, notes, and snippets.

View pdr-tuche's full-sized avatar
:octocat:
little media, lots of code ❌🧢

Pedro Neves pdr-tuche

:octocat:
little media, lots of code ❌🧢
View GitHub Profile
@pdr-tuche
pdr-tuche / express_async_errors.js
Created February 19, 2024 04:30 — forked from luizomf/express_async_errors.js
Express Async Errors
/* Express Route Adapter */
const resolver = (handlerFn) => {
return (req, res, next) => {
return Promise.resolve(handlerFn(req, res, next))
.catch(e => next(e));
}
}
/* Errors */
class InternalServerError extends Error {
@pdr-tuche
pdr-tuche / comandos-docker
Created February 16, 2024 17:55 — forked from morvanabonin/comandos-docker
Comandos do Docker
Segue a lista de comandos docker e sua utilidade:
docker attach – Acessar dentro do container e trabalhar a partir dele.
docker build – A partir de instruções de um arquivo Dockerfile eu possa criar uma imagem.
docker commit – Cria uma imagem a partir de um container.
docker cp – Copia arquivos ou diretórios do container para o host.
docker create – Cria um novo container.
docker diff – Exibe as alterações feitas no filesystem do container.
docker events – Exibe os eventos do container em tempo real.
docker exec – Executa uma instrução dentro do container que está rodando sem precisar atachar nele.
@pdr-tuche
pdr-tuche / OpenSSH.ps1
Created January 8, 2024 07:49
Installing OpenSSH on Windows
# https://learn.microsoft.com/pt-br/windows-server/administration/openssh/openssh_install_firstuse?tabs=powershell
# pre-requisitos
# Um dispositivo que executa pelo menos o Windows Server 2019 ou Windows 10 (build 1809).
# PowerShell 5.1 ou posterior.
# Uma conta que é membro do grupo de administradores internos.
# saber se usuario e adm
(New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) True # saber se o Openssh ta instalado
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH'
@pdr-tuche
pdr-tuche / aad.conf.json
Created December 3, 2023 21:14
Configuration Azure AD for django
{
"type": {
"client_type": "CONFIDENTIAL",
"authority_type": "SINGLE_TENANT",
"framework": "DJANGO"
},
"client":{
"client_id": "{enter your client id}",
"client_credential": "{enter your client credential}",
"authority": "https://login.microsoftonline.com/{enter your tenant id}",
@pdr-tuche
pdr-tuche / default nginx configuration file
Created November 17, 2023 23:41 — forked from xameeramir/default nginx configuration file
The default nginx configuration file inside /etc/nginx/sites-available/default
# Author: Zameer Ansari
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
@pdr-tuche
pdr-tuche / DigitalOceanAppDeploy.sh
Last active June 15, 2023 21:07
Run Command Digital Ocean App Config Django Rest Deploy
gunicorn --worker-tmp-dir /dev/shm application.wsgi
@pdr-tuche
pdr-tuche / JSdev
Last active March 16, 2023 01:50
JS/TS VScode profile
{"name":"JSdev","settings":"{\"settings\":\"{\\r\\n \\\"workbench.iconTheme\\\": \\\"material-icon-theme\\\",\\r\\n \\\"workbench.startupEditor\\\": \\\"none\\\",\\r\\n \\\"workbench.colorTheme\\\": \\\"Panda Syntax\\\",\\r\\n \\\"terminal.integrated.defaultProfile.windows\\\": \\\"PowerShell\\\", // estabelescendo git bash terminal padrao\\r\\n \\\"editor.formatOnSave\\\": true,\\r\\n \\\"diffEditor.ignoreTrimWhitespace\\\": false,\\r\\n \\\"powermode.enabled\\\": true,\\r\\n \\\"powermode.combo.location\\\": \\\"off\\\",\\r\\n \\\"powermode.shake.enabled\\\": false,\\r\\n \\\"[javascript]\\\": {\\r\\n \\\"editor.defaultFormatter\\\": \\\"esbenp.prettier-vscode\\\"\\r\\n },\\r\\n \\\"terminal.integrated.cursorStyle\\\": \\\"underline\\\",\\r\\n \\\"terminal.integrated.customGlyphs\\\": false,\\r\\n \\\"[python]\\\": {\\r\\n \\\"editor.formatOnType\\\": true\\r\\n }\\r\\n}\\r\\n\"}","tasks":"{\"tasks\":\"{}\"}","extensions":"[{\"identifier\":{\"id\":\"2gua.rainbow-brackets\",\"uuid\":\"79

comandos prompt postgres:

  • entrar no prompt postgres: sudo -u postgres psql postgres

  • sair das coisa: \q

  • criar senha para usuario: \password user

  • mostrar bancos: \l

@pdr-tuche
pdr-tuche / EnablePSScripts.ps1
Last active May 30, 2023 19:15
Habilitar PowerShell para execução de scripts
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
@pdr-tuche
pdr-tuche / jdk17.md
Created January 30, 2023 05:29
Instalando java openjdk 17

Instalação java jdk 17

sudo apt install openjdk-17-jdk openjdk-17-jre -y
java -version
javac -version
sudo update-alternatives --config java
  • criar variavel de ambiente a partir do caminho informado