Skip to content

Instantly share code, notes, and snippets.

View jfollmann's full-sized avatar
🏠
Working from home

Jefferson Follmann jfollmann

🏠
Working from home
View GitHub Profile
{
"diffEditor.ignoreTrimWhitespace": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"editor.codeLens": true,
"editor.columnSelection": false,
"editor.detectIndentation": false,
@jfollmann
jfollmann / hyper.js
Created February 23, 2023 01:54
Hyper Config
"use strict";
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
// default font size in pixels for all tabs
@jfollmann
jfollmann / rds_postgres_dump_restore.md
Last active December 20, 2022 16:58
How to create dump with docker to RDS postgres database

Create dump:

docker exec -i CONTAINER_NAME /bin/bash -c "PGPASSWORD=DATABASE_PASSWORD pg_dump --username DATABASE_USER -h RDS_HOST DATABASE_NAME" > ./dump.sql

Create local db to restore dump:

create database "db-restored"
Pega esse desafio:
Faça a soma de todos os produtos de todas as compras sem usar laços (loops - for, foreach, etc).
Use apenas map, reduce, recursão, etc.
const data = {
compras: [
{
data: '2022-01-01',
produtos: [
@jfollmann
jfollmann / contribs.sh
Created August 13, 2021 17:22
Show git repository contribs
#!/bin/env zsh
team_total=$(git shortlog -s -n |sed 's/\t/,/g'|cut -f1 -d, |bc -l|awk '{sum+=$1}END{print sum}');
tmp_counter='/tmp/counter.txt';
tmp_user='/tmp/users.txt';
tmp_percentage='/tmp/counters_users'
# if you are running this again it make the file empty or you can rm it
rm $tmp_percentage $tmp_user $tmp_counter
git shortlog -s -n |sed 's/\t/,/g'|cut -f2 -d, >>$tmp_user;
git shortlog -s -n |sed 's/\t/,/g'|cut -f1 -d, >>$tmp_counter;
// Examples of https://medium.com/@alvaro.saburido/set-theory-for-arrays-in-es6-eb2f20a61848
const arrA = [1, 3, 4, 5];
const arrB = [1, 2, 5, 6, 7];
const intersection = arrA.filter((x) => arrB.includes(x));
console.log('Intersection: ', intersection);
console.log('Expected: [1,5]');
const difference = arrA.filter((x) => !arrB.includes(x));
console.log('\nDifference: ', difference);
@jfollmann
jfollmann / intersection-difference-union.js
Created June 16, 2021 12:14
Array intersection, difference, and union in ES6
const arrA = [1, 3, 4, 5];
const arrB = [1, 2, 5, 6, 7];
const intersection = arrA.filter((x) => arrB.includes(x));
console.log('intersection', intersection);
// Output => intersection [ 1, 5 ]
const differenceA = arrA.filter((x) => !arrB.includes(x));
console.log('differenceA', differenceA);
// Output => difference [ 3, 4 ]
[global_config]
title_font = Ubuntu 9
title_receive_bg_color = "#8be9fd"
title_transmit_bg_color = "#ff5555"
[keybindings]
split_horiz = <Primary><Alt>e
[layouts]
[[default]]
[[[child1]]]
parent = window0
@jfollmann
jfollmann / spread-destructuring-rest-operator.js
Last active May 17, 2023 12:01
Spread, Destructuring and Rest Operator (Javascript)
// Execute: node spread-destructuring-rest-operator.js
// #### Spread Operator ####
const e1 = 'CODE';
const r1 = [...e1];
console.log('[01]', r1)
// Output => [ 'C', 'O', 'D', 'E' ]
const e2 = ['This', 'is', 'a', 'sentence'];
console.log('[02]', ...e2);
@jfollmann
jfollmann / findhardlinks.sh
Last active January 28, 2020 14:10
Script to find hard links in linux