Skip to content

Instantly share code, notes, and snippets.

View mariocesar's full-sized avatar

Mario-César mariocesar

View GitHub Profile
@mariocesar
mariocesar / README.md
Last active April 12, 2024 14:09
Prueba de revisión. Code Challenge. Programming Skills

Instrucciones para el candidato

Adjunto encontrarás un script de Python llamado script.py y un archivo CSV llamado data.csv.

  1. El archivo data.csv contiene datos de productos con las siguientes columnas: product_id, name, category_name, price, quantity.
  2. El script script.py carga los datos del archivo CSV, calcula la media, el promedio y la moda de los precios de los productos agrupados por categoría, y muestra los resultados en la consola.
  3. Tu tarea es revisar el código del script script.py y proponer cambios, mejoras o identificar cualquier problema, similar a lo que harías en una revisión a un Merge Request.
  4. Prepara tus comentarios, sugerencias y mejoras propuestas para discutirlas durante la siguiente entrevista.

El objetivo de este ejercicio es evaluar tus habilidades para identificar problemas, proponer mejoras y más que todo comunicar tus ideas de manera efectiva.

@mariocesar
mariocesar / main.yml
Created May 7, 2023 20:11
My espanso triggers configuration
matches:
- trigger: "!today"
replace: "{{mydate}}"
vars:
- name: mydate
type: date
params:
format: "%d/%m/%Y"
- trigger: "!now"
@mariocesar
mariocesar / README.md
Created April 5, 2023 14:20
A simple daemon script that I used for debugging running Docker containers in AWS ECS.

Outputs

{"name": "worker", "level": "INFO", "message": "Service start", "timestamp": "2023-04-05 14:04:48.974687279", "ip": "172.17.0.2", "pid": 7}
{"name": "worker", "level": "INFO", "message": "ping", "timestamp": "2023-04-05 14:04:48.975945036", "ip": "172.17.0.2", "pid": 7}
{"name": "worker", "level": "INFO", "message": "Received signal: SIGTERM", "timestamp": "2023-04-05 14:04:53.979013322", "ip": "172.17.0.2", "pid": 7}
{"name": "worker", "level": "INFO", "message": "Stopping", "timestamp": "2023-04-05 14:04:53.980930837", "ip": "172.17.0.2", "pid": 7}
@mariocesar
mariocesar / README.md
Last active April 5, 2023 14:18
Docker command and utils.

Useful Docker commands

Show all the files in a docker volume, use: docker-list-volume-contents volume_name

function docker-list-volume-contents() {
    docker run --rm -v ${1}:/data -it alpine find /data -type f
}
@mariocesar
mariocesar / README.md
Last active February 9, 2023 15:12
NPM and Javascript fixes
import sys
import math
import re
def verhoeff(num, times):
d = [
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
[1, 2, 3, 4, 0, 6, 7, 8, 9, 5],
@mariocesar
mariocesar / workflow.yml
Created December 21, 2022 16:35
Argo example to set arguments with Python
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
name: generate-parameters-workflow
namespace: workflow-prod
generateName: generate-parameters-
spec:
entrypoint: Main
serviceAccount: workflow
serviceAccountName: workflow
@mariocesar
mariocesar / README.md
Created August 26, 2022 20:12
VIM things

Read content from the current buffer and run it in python.

exec '!echo ' . shellescape(join(getline(1, '$'), '\n'), 1) . ' | python --'
@mariocesar
mariocesar / get_s3_regions.py
Last active February 24, 2022 15:28
Get all available regions supported by boto library for an AWS service, like S3
from botocore.loaders import create_loader
from botocore.regions import EndpointResolver
endpoints = create_loader().load_data('endpoints')
partitions = [part['partition'] for part in endpoints['partitions']]
for partition in partitions:
s3_regions = EndpointResolver(endpoints).get_available_endpoints("s3", partition)
aws_partition = next(