Skip to content

Instantly share code, notes, and snippets.

View ThomRoman's full-sized avatar

ThomRoman

View GitHub Profile
@ThomRoman
ThomRoman / docker-compose.yaml
Created June 29, 2022 20:17 — forked from w0rldart/docker-compose.yaml
MariaDB docker-compose with UTF8 Collation
version: '3.1'
services:
db:
image: mariadb
restart: always
command: mysqld --character-set-server=utf8 --collation-server=utf8_unicode_ci --init-connect='SET NAMES UTF8;' --innodb-flush-log-at-trx-commit=0
ports:
- 3306:3306
@ThomRoman
ThomRoman / vite-testing-config.md
Created June 20, 2022 03:33 — forked from Klerith/vite-testing-config.md
Vite + Testing + Jest - Completo

Instalación y configuracion de Jest + React Testing Library

En proyectos de React + Vite

  1. Instalaciones:
yarn add --dev jest babel-jest @babel/preset-env @babel/preset-react 
yarn add --dev @testing-library/react @types/jest jest-environment-jsdom
  1. Opcional: Si usamos Fetch API en el proyecto:
interface Task {
  id: number;
  title: string;
  completed: boolean;
  createdAt: Date;
}

interface CreateTaskDto extends Omit<Task, 'id' | 'createdAt'> {}
interface UpdateTaskDto extends Omit<Partial<Task>, 'id'> {}
@ThomRoman
ThomRoman / init.sh
Last active May 26, 2022 05:16
Volumes
docker run --name postgres10 -e POSTGRES_PASSWORD=postgres -v /var/data/docker-containers/postgres/v10:/var/lib/postgresql/data -p 5432:5432 -d postgres:10.21
docker run --name postgres14 -e POSTGRES_PASSWORD=postgres -v /var/data/docker-containers/postgres/v14-latest:/var/lib/postgresql/data -p 5433:5432 -d postgres:latest
docker run --name mysql8 -e MYSQL_ROOT_PASSWORD=mysql -v /var/data/docker-containers/mysql/v8-latest:/var/lib/mysql -p 3306:3306 -d mysql:latest --character-set-server=utf8 --collation-server=utf8_unicode_ci
docker run -d --name mongo5 -v /var/data/docker-containers/mongo:/data/db mongo
@ThomRoman
ThomRoman / example.js
Created May 21, 2022 22:21 — forked from magemore/example.js
upload image from clipboard on ctrl+v event on page
function uploadFile(file) {
var formData = new FormData();
formData.append("userfile", file);
var request = new XMLHttpRequest();
request.onload = function () {
if (request.status == 200) {
document.location.href='/';
} else {
alert('Error! Upload failed');
}
import sys
import random
listacubos = []
primos = 0
repeticiones = {}
import math
def esprimo(num):
for n in range(2,int(num**0.5)+1):
if num%n==0:
return False
@ThomRoman
ThomRoman / git-alias.md
Last active February 23, 2022 21:59 — forked from Klerith/git-alias.md
Useful Git Alias

git logda

git config --global alias.logda "log --oneline --graph --decorate --all

git s

git config --global alias.s "status

git sl => super log

git config --global alias.lg "log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all"

git ss => status short

@ThomRoman
ThomRoman / scripts.sh
Last active May 15, 2022 22:37
Apuntes
vim file_key
chmod 600 file_key
ssh -i file_key root@ip
ps -e
ls /etc
file /sbin/init
############################
sl -Flea
#include <LiquidCrystal.h>
#define ECHO 10 //Pin digital 10 para el Echo del sensor
#define TRIG 9 //Pin digital 9 para el Trigger del sensor
double tiempo = 0;
double distancia = 0; //
LiquidCrystal lcd(12,11,5,4,3,2);
void setup() {
pinMode(TRIG, OUTPUT); //pin como salida
pinMode(ECHO, INPUT); //pin como entrada
if __name__ == "__main__":
numeroDeProcesos = int(input("Digite el numero de procesos : "))
print("\n")
arrProcesos = []
arrTemporalProcesos = []
for i in range(numeroDeProcesos):
tiempoLlegada = int(input("Ingrese el tiempo de llegada : "))
tiempoRafaga = int(input("Ingrese el tiempo de rafaga : "))
print("\n")