Skip to content

Instantly share code, notes, and snippets.

View ilmoralito's full-sized avatar

Mario Martinez ilmoralito

View GitHub Profile
@ilmoralito
ilmoralito / commands.txt
Created July 4, 2022 04:07
comunicate containers using DNS name
# EXAMPLE > DEFAULT BRIDGE NETWORK
START MYSQL WITH CUSTOM ROOT PASSWORD
docker run -e MYSQL_ROOT_PASSWORD=hotch mysql
START MYSQL CLIENT
docker exec -it <CONTAINER_ID> bash
GET MYSQL ROOT PASSWORD
docker exec <CONTAINER_ID> env
Algoritmo sin_titulo
T = 10
Dimension arreglo[T]
arreglo[0] <- 100
arreglo[1] <- 20
arreglo[2] <- 5
arreglo[3] <- 1
arreglo[4] <- 16
arreglo[5] <- 3
Algoritmo ordenamiento_por_insercion
T = 10
Dimension arreglo[T]
arreglo[0] <- 100
arreglo[1] <- 20
arreglo[2] <- 5
arreglo[3] <- 1
arreglo[4] <- 16
arreglo[5] <- 3
@ilmoralito
ilmoralito / index.html
Created January 25, 2022 22:08
sample using flex
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
.main {
display: flex;
@ilmoralito
ilmoralito / sample.c
Created January 22, 2022 02:56
C sizeof example
#include <stdio.h>
int main(void)
{
printf("char size: %lu bytes\n", sizeof(char));
printf("int size: %lu bytes\n", sizeof(int));
printf("short size: %lu bytes\n", sizeof(short));
printf("long size: %lu bytes\n", sizeof(long));
printf("float size: %lu bytes\n", sizeof(float));
printf("double size: %lu bytes\n", sizeof(double));
@ilmoralito
ilmoralito / mysql-docker.sh
Created August 17, 2021 18:52 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
# add docker format to environment
export FORMAT="ID\t{{.ID}}\nNAME\t{{.Names}}\nIMAGE\t{{.Image}}\nPORTS\t{{.Ports}}\nCOMMAND\t{{.Command}}\nCREATED{{.CreatedAt}}\nSTATUS\t{{.Status}}\n"
# list docker containers pretty formatted
docker ps --format=$FORMAT
@ilmoralito
ilmoralito / mime.html
Created November 8, 2020 06:13 — forked from topalex/mime.html
How to check real mime type of image in javascript
<html>
<head>
<script type="text/javascript" src="/jquery.min.js"></script>
<title>Mime type checker</title>
<script>
$(function () {
var result = $('div#result');
if (window.FileReader && window.Blob) {
$('span#submit').click(function () {
var files = $('input#file').get(0).files;
@ilmoralito
ilmoralito / sample_output.js
Created August 4, 2020 17:00
Sample output
[
2020-08-04T00:00:00.000Z,
2020-08-06T00:00:00.000Z,
2020-08-11T00:00:00.000Z,
2020-08-13T00:00:00.000Z,
2020-08-18T00:00:00.000Z,
2020-08-20T00:00:00.000Z,
2020-08-25T00:00:00.000Z,
2020-08-27T00:00:00.000Z,
2020-09-01T00:00:00.000Z
@ilmoralito
ilmoralito / jornadas.js
Last active August 4, 2020 17:47
Jornadas
const startDate = "2020-08-03";
const matchDays = [1, 2];
const fields = ["Field 1", "Field 2"];
const teams = ["A", "B", "C", "D"];
const numberOfRematches = 3;
const getCombinations = (data) => {
let output = [];
for (let i = 0; i < teams.length - 1; i++) {