Skip to content

Instantly share code, notes, and snippets.

View 1cadumagalhaes's full-sized avatar

Carlos Eduardo Magalhães 1cadumagalhaes

View GitHub Profile

Keybase proof

I hereby claim:

  • I am 1cadumagalhaes on github.
  • I am 1cadumagalhaes (https://keybase.io/1cadumagalhaes) on keybase.
  • I have a public key ASA5MYbQLbKnQgIfBAxXGYwOIBodinepitKJYKvWrR3Dbwo

To claim this, I am signing this object:

@1cadumagalhaes
1cadumagalhaes / pyenvs
Created May 26, 2023 18:18
Shell script developed to center python virtual environment commands. To use, just place it on /usr/loca/bin/pyenvs and you can run as: pyenvs list, pyenvs create [environment], source pyenvs activate [environment]
#!/bin/zsh
function create_venv() {
if [ $# -eq 0 ]; then
echo "Please provide the name of the virtual environment to create"
return 1
fi
venv_name="$1"
venv_dir="$HOME/.venvs"
if [ $# -eq 2 ]; then
@1cadumagalhaes
1cadumagalhaes / sorteio.js
Last active December 30, 2022 13:40
Algoritmos completamente desnecessários mas divertidos de se pensar.
function generateArray(numbers = 60) {
return Array.from({ length: 60 }, (_, i) => i + 1)
}
function shuffleArray(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
const temp = array[i];
array[i] = array[j];
array[j] = temp;
@1cadumagalhaes
1cadumagalhaes / .env
Created November 16, 2022 20:53
Apache Airflow with Docker
_PIP_ADDITIONAL_REQUIREMENTS=dbt-core dbt-bigquery
# Copyright 2022 DP6
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@1cadumagalhaes
1cadumagalhaes / schema.json
Created October 4, 2021 20:52
Exemplo de schema do Datalayer Collect
{
"$schema": "",
"title": "Schema example",
"array": {
"$id": "#/properties/schema",
"type": "array",
"items": [
{
"type": "object",
"properties": {
@1cadumagalhaes
1cadumagalhaes / processLineByLine.js
Created July 6, 2021 22:08
Função para leitura e transformação de arquivos de texto em stream
const fs = require('fs');
const readline = require('readline');
async function processLineByLine(input, output='output.csv', callback) {
let lineCount = 0;
try {
const fileStream = fs.createReadStream(input);
const outstream = fs.createWriteStream(output);
const rl = readline.createInterface({
@1cadumagalhaes
1cadumagalhaes / emails.js
Last active June 23, 2021 16:50
List emails using apps script
/**
* Creates and runs a search query on gmail.
* @param {Object} [$0] - params.
* @param {String} [$0.from=null] - email sender.
* @param {String} [$0.to=null] - email receiver.
* @param {String} [$0.label=null] - email label.
* @param {String} [$0.period="id"] - period to search for.
* @returns {{Assunto: "Subject of the thread", Emails: "Quantity of emails on the thread", lastMessageDate: "Date of the last message", lastMessageSender: "Contact that sent the last message on the thread"}}
*/
function searchEmails({from = null, to = null, label=null, period='1d'}){

Para executar:

node sorteio -s=[sorteios] -n=[numeros] -min=[minimo] -max=[maximo]

Por padrão sorteios = 1, numeros = 6, min=1 e max=60.

Para instruções:

node sorteio -h