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
variable "key_name" { | |
type = string | |
default = "manager_rsa" | |
} | |
# Creates a private key and saves it in Terraform state without encryption | |
# https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key | |
resource "tls_private_key" "rsa_key" { | |
algorithm = "RSA" | |
rsa_bits = 4096 |
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
function decodeUint8(bufferArray: Uint8Array) { | |
return bufferArray | |
.reduce((acc, buffer) => acc.concat(String.fromCharCode(buffer)), ""); | |
}; |
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
function encodeUint8(str: string) { | |
const buffer = str | |
.split("") | |
.reduce((acc,char) => [ | |
...acc, | |
char.charCodeAt(0) >>> 8, | |
char.charCodeAt(0) & 0xff | |
], | |
[]); |
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
SELECT | |
query, | |
calls, | |
total_time::integer, | |
max_time::integer, | |
rows, | |
100.0 * shared_blks_hit / nullif(shared_blks_hit + shared_blks_read, 0) AS hit_percent | |
FROM pg_stat_statements | |
ORDER BY total_time DESC LIMIT 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
SELECT reltuples FROM pg_class WHERE oid = 'my_schema.my_table'::regclass; |
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 of PHI 1,618034 | |
function randomNumber() { | |
const randomSeed = (new Date()).getTime(); | |
return parseInt((Math.random() * 100) % 16180339 * randomSeed, 10); | |
} |
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 routes = require('express').Router() | |
const UserController = require('../app/controllers/UserController') | |
const AuthController = require('../app/controllers/AuthController') | |
// Authentication routes | |
routes.post('/signin', AuthController.store) | |
// User routes | |
routes.post('/', UserController.store) |
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 dotenv = require('dotenv'); | |
dotenv.config({ | |
path: process.env.NODE_ENV === 'test' ? '.env.test' : '.env', | |
}); | |
module.exports = { | |
secret: process.env.APP_SECRET, | |
env: process.env.NODE_ENV, | |
token: process.env.JWT_SECRET, |
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
module.exports = { | |
userSuccess: 'Usuário foi criado com sucesso', | |
userError: 'Usuário não pode ser criado', | |
userNotFound: 'Usuário não encontrado', | |
userAlreadyExist: 'Usuário já existe na nossa base de dados' | |
} |
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 moment = require('moment'); | |
module.exports = (date) => (date === undefined && !moment(date, moment.ISO_8601, true).isValid()); |
NewerOlder