Skip to content

Instantly share code, notes, and snippets.

View ilmoralito's full-sized avatar

Mario Martinez ilmoralito

View GitHub Profile
@ilmoralito
ilmoralito / app.php
Last active March 29, 2024 15:00
Simple PHP lambda example
<?php
$books = [
[
'name' => 'Earth 1',
'author' => 'Andrew',
'pubDate' => '2024-03-08'
],
[
'name' => 'Earth 3',
@ilmoralito
ilmoralito / list.txt
Created December 1, 2022 15:57
switch php versions - ubuntu
1. (optional) install some php version: sudo apt -y install php7.4
2. switch php version: sudo update-alternatives --config php
2.1. disable current version: sudo a2dismod php7.1
2.2. enable version: sudo a2enmod php7.4
3. restart apache sudo systemctl restart apache2
@ilmoralito
ilmoralito / commands.txt
Created July 4, 2022 05:00
docker custom network mysql, phpmyadmin, wordpress
CREATE CUSTOM NETWROK
docker network create wordpress
# START MYSQL
docker run \
--network wordpress \
-e MYSQL_ROOT_PASSWORD=hotch \
-e MYSQL_DATABASE=sample \
-e MYSQL_USER=mario \
@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