Skip to content

Instantly share code, notes, and snippets.

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

Adrián mrroot5

🏠
Working from home
View GitHub Profile
@mrroot5
mrroot5 / elixir_type_protocol.ex
Created December 27, 2021 16:26
Elixir type protocol like Python. Keywrods: elixir, protocols, elixir protocols, type, elixir type, polymorphism, elixir polymorphism
defprotocol TypeProtocol do
@doc """
TypeProtocol checks a term type.
"""
@spec type(t) :: String.t()
def type(value)
end
defimpl TypeProtocol, for: Float do
@spec type(float) :: String.t()
@mrroot5
mrroot5 / development_cycle.md
Last active September 12, 2022 10:38
Ciclo de desarrollo cheatsheet - development cycle cheatsheet
flowchart TD
   id1(Asignarse un issue)
   %%id2(Mover el issue a 'In Progress')
   id3(Leerlo)
   id4{"Hacerme las preguntas de 'por qué' y 'para qué'.<br /> ¿Es aplicable?"}
   id5(Investigar sobre lo que no conozco)
   id6(Pensar y diseñar la solución)
   id7{"Le pregunto a un experto, ¿Es válido?"}
   id8(Lo programo)
@mrroot5
mrroot5 / terminator-cheatsheet.md
Created March 4, 2020 11:54
Terminator cheatsheet

Terminator Cheat Sheet

Split, resize, rotate, rename, move... all you need is terminator.

Splitting windows

Command Action
Ctrl+Shift+O/E horizontal / vertical split
Ctrl+Shift+W close the view where the focus is on
@mrroot5
mrroot5 / docker_container_image_remove.md
Last active April 4, 2022 19:21
Borrar contenedores e imágenes de docker. También <none>. Keyords: prune, docker, images, docker images, docker prune, stop, docker stop, docker ps, ps.

Intro

En este fichero vas a aprender algunos comandos básicos para parar y eliminar contenedores además de imágenes de docker.

Contenedores

Parar todos los contenedores

docker stop $(docker ps -a -q)
@mrroot5
mrroot5 / elixir_utils_helper.md
Last active January 28, 2022 11:52
Elixir util / helper functions. Keywords: elixir, helpers, utils, elixir utils, elixir helpers.
@mrroot5
mrroot5 / elixir_cheatsheet.md
Last active January 21, 2022 09:51
Elixir cheatsheet. Keywords: elixir, how to, elixir how to, cheatsheet, elixir cheatsheet

Intro

Elixir cheat sheet with a question and explanation.

How to print a list of integers avoiding ASCII conversion?

numbers_list = [104, 101, 108, 108, 111]
# Output:hello
@mrroot5
mrroot5 / install-letsencrypt-ubuntu.md
Created January 20, 2022 11:47
Install Letsencrypt cert. into a debian/ubuntu. Keywords: letsencrypt, ubuntu, ubuntu letsencrypt

Intro

How to set up letsencrypt on a debian/ubuntu machine. Step by step:

Update and install Certbot

$ apt update
# for apache-using web server
$ apt install certbot python3-certbot-apache
@mrroot5
mrroot5 / power-off-shutdown-desktop.md
Last active January 12, 2022 16:49
Power off button shutdown button. Keywords: ubuntu, power off, shutdown.

Intro

Create a button to shutdown the PC.

  • Create a .desktop file:
vim ~/.local/share/applications/shutdown-for-dock.desktop
@mrroot5
mrroot5 / programatically_create_dataclass.md
Last active November 16, 2021 07:10
Crear dataclass en python dinámicamente. Convertir pydantic schema a dataclass. Keywords: python, dataclass, python dataclasss, pydantic, schema, pydantic schema

Intro

Creación dinámica de una dataclass. Puede ser útil, por ejemplo, para convertir un schema de pydantic en un dataclass.

Requisitos

Python >= 3.7.

Ejemplo de uso

@mrroot5
mrroot5 / find_key_in_list_dict.md
Last active November 7, 2021 14:27
Python: utils listado de diccionarios. Keywords: python, python utils, list, list in dict, dict key in list, key in list dict, key, dict key, list dict key

Intro

Se pretende encontrar un clave dentro de un listado de disccionarios con Python.

Los dos ejemplos que veremos a continuación usando un generator expression o lambda function con filter son equivalentes.

Datos de ejemplo

people = [