Skip to content

Instantly share code, notes, and snippets.

View erichnascimento's full-sized avatar

Erich Nascimento erichnascimento

View GitHub Profile
INSERT INTO public.banks (id, name, ispb_code, compensation_code, created_at, updated_at) VALUES ('113cd26a-e451-4a86-8fef-e30d353860f3', 'BCO DO BRASIL S.A.', '0', '1', '2023-08-25 12:04:04.798226', null);
INSERT INTO public.banks (id, name, ispb_code, compensation_code, created_at, updated_at) VALUES ('2abd0e9c-8a84-406c-8e85-60b9c27ff52d', 'BRB - BCO DE BRASILIA S.A.', '208', '70', '2023-08-25 12:04:04.798226', null);
INSERT INTO public.banks (id, name, ispb_code, compensation_code, created_at, updated_at) VALUES ('a67e2928-9a99-4688-b66f-e27a61a0af84', 'SANTINVEST S.A. - CFI', '122327', '539', '2023-08-25 12:04:04.798226', null);
INSERT INTO public.banks (id, name, ispb_code, compensation_code, created_at, updated_at) VALUES ('a7c6613f-08b6-4303-8a6a-68f949f8d290', 'CCR SEARA', '204963', '430', '2023-08-25 12:04:04.798226', null);
INSERT INTO public.banks (id, name, ispb_code, compensation_code, created_at, updated_at) VALUES ('b7100d66-f3b5-4968-83b3-967f3c0da6fa', 'AGK CC S.A.', '250699', '272', '2023-0
@erichnascimento
erichnascimento / bind-dot-to-comma-mac-keyboard.sh
Created February 2, 2023 17:41
Bind Apple Numeric Keyboard dot key to comma due to BRL currency on MacOS Ventura
mkdir -p $HOME/Library/KeyBindings
nano $HOME/Library/KeyBindings/DefaultKeyBinding.dict
# Put the following content into them
#
# {
# "#." = ("insertText:", ",");
# }
#
#!/usr/bin/env bash
# Install Nodejs
curl https://nodejs.org/dist/v8.12.0/node-v8.12.0-linux-x64.tar.xz -O \
&& tar xf node-v8.12.0-linux-x64.tar.xz \
&& cp -R node-v8.12.0-linux-x64/* /usr/local \
&& rm -rf node-v8.12.0-linux-x64 \
&& rm -f node-v8.12.0-linux-x64.tar.xz
@erichnascimento
erichnascimento / db.1.rake
Created November 19, 2017 21:34 — forked from maxd/db.1.rake
Rake task for drop active connections to PostgreSQL database
namespace :db do
namespace :drop do
task connections: :environment do
begin
database = ActiveRecord::Base.connection.current_database
ActiveRecord::Base.connection.execute(<<-SQL)
SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = '#{database}' AND pid <> pg_backend_pid();
SQL
@erichnascimento
erichnascimento / bind-port.sh
Created August 19, 2016 17:10
Bind Vagrant port to host port
# List the Vagrant config to get ip address and key path
$ vagrant ssh-config
# Bind port
$ sudo ssh -L 0.0.0.0:80:<vagran-ip>:80 -i <path-to-listed-private-key> -p 2222 -N vagrant@localhost
@erichnascimento
erichnascimento / carta-contribuicao-sindical.txt
Created June 16, 2016 20:31
Modelo de carta para não autorizar o desconto da contribuição sindical
Ao Sindicato __
Assunto: CONTRIBUIÇÃO CONFEDERATIVA/CONTRIBUIÇÃO ASSISTENCIAL
Eu ........., portadora da carteira profissional n.º ............, CPF e RG regularmente registrada na empresa (NOME DA EMPRESA e CNPJ) com sede à (ENDEREÇO), Nº , bairro,..........., venho, informar que não concordo com o desconto referente a Contribuição Confederativa / Assistencial que veio a ser determinado pela Convenção Coletiva do Trabalho 20xx/20xx e não autorizo o desconto da mesma em folha de pagamento.
Sendo só para o momento, firmo a presente;
Assinatura do trabalhador
package main
import (
"fmt"
"log"
"math/rand"
"time"
)
var massas = []string{"fina", "media", "grossa"}
@erichnascimento
erichnascimento / Amazon EC2 tunnel.sh
Created February 3, 2016 16:46
Using Amazon EC2 instance as proxy
# Add PEM key
ssh-add my-key.pem
# Open a local tunnel for all interfaces, using port 6352
ssh -D 0.0.0.0:6352 -f -C -q -N ubuntu@web1.slcty.co
#!/usr/bin/env bash
# Reference: https://ask.fedoraproject.org/en/question/9111/sticky-what-plugins-do-i-need-to-install-to-watch-movies-and-listen-to-music/
#
# Set up the repositories
#
sudo yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm
#
# Install minimal
@erichnascimento
erichnascimento / first-row-each-group.sql
Created September 17, 2015 20:15
Select first row in each GROUP BYgroup
/*
On Oracle 8i+, SQL Server 2005+, PostgreSQL 8.4+, DB2, Firebird 2.1+, Teradata, Sybase, Vertica:
*/
WITH summary AS (
SELECT p.id,
p.customer,
p.total,
ROW_NUMBER() OVER(PARTITION BY p.customer
ORDER BY p.total DESC) AS rk
FROM PURCHASES p)