Skip to content

Instantly share code, notes, and snippets.

@aleixmorgadas
aleixmorgadas / README.md
Created July 29, 2023 11:33
Keychron VIA app Linux

Keychron VIA app Linux

Open chromium.

Go to https://usevia.app/

You might see the error:

Vid: 0x3434
@aleixmorgadas
aleixmorgadas / 0_README.md
Last active April 7, 2025 12:36
Starting a FastAPI as a server mock

Using FastAPI as Server Mock

I wanted to start a real mock server with real instances that I could fine tune for my own needs.

I found a way to start the FastAPI to run the tests agains it, and then kill the uvicorn.

Here an example code 👍

image

How to calculate your hourly rate as a freelancer?

Many people struggle with this question. Some just try to make as much as a full-time employee makes (and ignore that they won't be able to bill as many days). Others follow tips on startup related websites that suggest to ask for 20% to 50% more than an salary would yield (and ignore the additional risk and expenses they have).

Below you will find some numbers to help you calculate how high your hourly or daily rate should be.

Your yearly income should be higher than an average salary

  • You take more risk than full time employees, phases without income are likely
@aleixmorgadas
aleixmorgadas / 0_README.md
Created July 8, 2024 06:14
Most common crawler URIs to be ignored by OpenTelemetry SDK to avoid false alarms

Ignored URIs

We don't want our monitoring systems to raise an alert for each GET 404 Not Found because there are crawlers that try certain URIs.

Here a list of the most common URIs used by crawlers to be added to OpenTelemetry.

const sdk = new NodeSDK({
  instrumentations: [
 getNodeAutoInstrumentations({

Invariantes vs Reglas de negocio

A partir de esta conversación escribo este Gist.

Posible caso

Tenemos un almacen que tiene un stock por producto.

Regla de negocio:

  • No podemos vender un producto que no tenemos stock.
@aleixmorgadas
aleixmorgadas / .0_README.md
Created September 2, 2023 19:03
Mocking Storybook dependencies with vue3-vite

Mocking Storybook dependencies with vue3-vite

When you are using @storybook/vue3-vite and you are wondering how to mock external modules, here an example.

In this case, I will mock the Auth0-vue module so that I can render components without problems.

:information: The files have a $ to represent a folder because / it is not permited charater in a gitst

@aleixmorgadas
aleixmorgadas / install-node-pulsar-client-m1.md
Created July 19, 2022 20:42
Install node pulsar-client in Apple Silicon M1/M2 Chip

Installing node pulsar-client

https://www.npmjs.com/package/pulsar-client

You might found an error like

...
ERR! install response status 404 Not Found on https://pulsar.apache.org/docs/en/client-libraries-cpp/libpulsar-v1.6.2-node-v93-darwin-arm64.tar.gz
...
@aleixmorgadas
aleixmorgadas / AbstractIntegrationTest.java
Created December 5, 2023 18:47
Signelton Abstract Integration Test to reuse a Testcontainer between test classes
package dev.aleixmorgadas;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
import org.springframework.test.web.servlet.MockMvc;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.junit.jupiter.Testcontainers;
@aleixmorgadas
aleixmorgadas / Instructions.md
Last active September 12, 2023 06:31
Installing Linux in Asus Zenbook 14 UX431FA

Install Debian in Asus Zenbook 14 UX431FA

Debian version Bullseye

⚠️ using the non-free of Debian because it needs specific firmware for the wifi to be able to connect.

  1. Download the next netinst.iso https://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/bullseye_di_alpha2/amd64/iso-cd/ or newer.

I'm using the bullseye because it has the latest kernel, and it seems required for this laptop. Also, the link might breake because the alpha2 it's no longer available because Debian Bullseye has already a beta version or it's released as stable distribution. In that case, check the root directory https://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/

@aleixmorgadas
aleixmorgadas / 0_README.md
Last active September 6, 2023 15:59
Testcontainers MongoDB with volume and fixed ports.

Testcontainers MongoDB with volume and fixed ports

For the example, I'm using SpringBoot in DevMode. It is the only mode I consider that makes sense to enable the volume mapping.

Remember to add .data/ to .gitignore