Skip to content

Instantly share code, notes, and snippets.

View mdamaceno's full-sized avatar
🇧🇷

Marco Damaceno mdamaceno

🇧🇷
View GitHub Profile
@mdamaceno
mdamaceno / benchmark_result.txt
Last active June 21, 2024 19:53
Benchmark regular loop vs loop with rescue in Ruby
ruby 2.6.6p146 (2020-03-31 revision 67876) [-darwin23]
Warming up --------------------------------------
regular loop 2.135k i/100ms
loop with rescue 193.201k i/100ms
Calculating -------------------------------------
regular loop 21.215k (± 2.1%) i/s - 106.750k in 5.034189s
loop with rescue 1.910M (± 3.0%) i/s - 9.660M in 5.062752s
/**
* MIT License
*
* Copyright (c) 2020 Rodrigo Martins
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights *
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
{"version":1,"resource":"file:///home/mdamaceno/Projects/rd/frontend-quality-assurance/packages/eslint-config-react/rules/g11n.js","entries":[{"id":"47ZG.js","timestamp":1652121655227}]}
@mdamaceno
mdamaceno / getUser-pgsql.js
Last active August 23, 2019 19:41
Auth0 custom scripts for connections
async function loginByEmail(email, callback) {
//this example uses the "pg" library
//more info here: https://github.com/brianc/node-postgres
const bcrypt = require('bcrypt');
const postgres = require('pg');
const conString = 'postgres://username:password@localhost:5432/database_name';
const client = await new pg.Client(conString);
client.connect();
@mdamaceno
mdamaceno / instrucoes-instalacao-microk8s.md
Last active January 23, 2019 12:12
Como instalar Microk8s com Docker e Helm

Instruções

Instalar Microk8s

Seguir instruções em https://microk8s.io/docs/

Inserir contexto do Microk8s no comando kubectl para o Helm

$ mkdir $HOME/.kube
@mdamaceno
mdamaceno / remove_not_null.sql
Created May 30, 2018 13:13
Remove NOT NULL from a column in Firebird database
ALTER TABLE TABLE_NAME ADD COLUMN_NAME_AUX TYPE;
UPDATE TABLE_NAME SET COLUMN_NAME_AUX = COLUMN_NAME;
ALTER TABLE TABLE_NAME DROP COLUMN_NAME;
ALTER TABLE TABLE_NAME ADD COLUMN_NAME TYPE;
UPDATE TABLE_NAME SET COLUMN_NAME = COLUMN_NAME_AUX;
@mdamaceno
mdamaceno / remove-constraints-procedure.sql
Created March 13, 2018 19:33
Remove all constraints in a Firebird database
CREATE OR ALTER PROCEDURE REMOVE_CONSTRAINTS AS
DECLARE VARIABLE stmt VARCHAR(255);
begin
BEGIN
FOR
select 'ALTER TABLE '||r.rdb$relation_name
||' DROP CONSTRAINT '||r.rdb$constraint_name||';'
from rdb$relation_constraints r
where (r.rdb$constraint_type='FOREIGN KEY')
{
"tipo":"J",
"documento":"31661374000181",
"nomeOrigem":"DIGITAL-CEDENTE",
"tipoRelacionamento":"C",
"pessoa":{
"codigoSistemaGestao":"99910715",
"nome":"LIVRARIA E EDITORA LUMEN JURIS EIRELI EP",
"razaoSocial":"LIVRARIA E EDITORA LUMEN JURIS EIRELI EP",
"rg":null,
[{
"tipo": "J",
"documento": "04843556000109",
"nomeOrigem": "DIGITAL-CEDENTE",
"tipoRelacionamento": "C",
"pessoa": {
"codigoSistemaGestao": "999012223",
"nome": "TERMOEPS COM. E IND. DE PLASTICOS LTDA",
"razaoSocial": "TERMOEPS COM. E IND. DE PLASTICOS LTDA",
"rg": null,
[
{
"tipo":"J",
"documento":"03221361000156",
"nomeOrigem":"DUNAS-CEDENTE",
"tipoRelacionamento":"C",
"pessoa":{
"codigoSistemaGestao":"999012559",
"nome":"AGUIAR CORREA DE PAIVA NETO EPP",
"razaoSocial":"AGUIAR CORREA DE PAIVA NETO EPP",