Skip to content

Instantly share code, notes, and snippets.

View vacax's full-sized avatar

Carlos Camacho vacax

View GitHub Profile
@vacax
vacax / conf
Created June 22, 2022 20:20
Configuración virtualhost sin SSL
<VirtualHost *:80>
ServerAdmin admin@admin.com
ServerName <<MiIP>>
ProxyPreserveHost On
ProxyRequests On
@vacax
vacax / ssh-generation.sh
Last active March 14, 2022 05:31
Script para crear llave rsa de ssh para conexión
#!/bin/sh
FILE=/root/.ssh/id_rsa_nuevo.pub
if [ ! -f "$FILE" ]; then
yes yes | ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa_nuevo
cp $FILE /home/ucjc/
fi
if [ ! -f /home/ucjc/sshd_config ]; then
cat /etc/ssh/sshd_config > /home/ucjc/sshd_config
chmod 777 /home/ucjc/sshd_config
fi
@vacax
vacax / main.c
Created March 8, 2022 16:03
Clase de ICC-103 - 8/03/2022
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef struct {
char clave[4];
char nombre[100];
} Carrera;
typedef struct {
@vacax
vacax / filtro-rutas-javalin.txt
Last active February 23, 2021 15:59
Ruta con filtro activado para todo un contexto en Javalin
Javalin app = getInstanciaJavalin();
app.routes(()->{
path("/path/", () -> {
before(ctx -> {
System.out.println("Entrando a la ruta path...");
});
get("/", ctx -> {
ctx.result("Ruta path /");
});
@vacax
vacax / gist:006353d26dd137071a4a54ab0fad0ed9
Created October 16, 2020 20:52
Configuración HAProxy sobre escribiendo la sesiones.
listen aplicacion_web
bind *:80
mode http
stats enable
stats uri /stats
stats realm HAProxy\ Statistics
stats auth cda:cda
balance roundrobin
cookie JSESSIONID prefix nocache
server app-01 localhost:7000 check
@vacax
vacax / gist:b3df793613373fb1f3be7b35aa138b67
Created October 16, 2020 20:29
Configuración de HAProxy para uso de Sesiones
listen aplicacion_web
bind *:80
mode http
stats enable
stats uri /stats
stats realm HAProxy\ Statistics
stats auth cda:cda
balance roundrobin
cookie SERVERID insert indirect nocache
server app-01 localhost:7000 check cookie s1
@vacax
vacax / gist:c92bb3826561be55b78b64aed0fdcd8f
Created October 16, 2020 19:36
Configuración HAProxy Basico
listen aplicacion_web
bind *:80
mode http
stats enable
stats uri /stats
stats realm HAProxy\ Statistics
stats auth cda:cda
balance roundrobin
server app-01 localhost:7000 check
server app-02 localhost:7001 check
docker run --name micro-mysql-interno -v ~/data-mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=12345678 -e MYSQL_DATABASE=app --network app_basedatos -d -p 33007:3306 mysql:5.7.26
@vacax
vacax / gist:75197d177169c892a068133e0ea23bfb
Created July 26, 2019 22:08
Consulta y creación de Estudiante en Cliente Rest
package edu.pucmm.hlr;
import kong.unirest.HttpResponse;
import kong.unirest.JsonNode;
import kong.unirest.Unirest;
import org.json.JSONObject;
public class Main {
@vacax
vacax / gist:2053e975a14959d81d0f53ac77c6da23
Created July 26, 2019 21:56
Ejemplo de leer estudiantes de Servidor Sparkjava-Restful
public static void main(String[] args) {
System.out.println("Hola Mundo Rest Cliente :-D");
HttpResponse<JsonNode> response = Unirest.get("http://localhost:4567/rest/estudiantes/")
.header("accept", "application/json")
.queryString("apiKey", "123")
.asJson();
//
System.out.println("Codigo respuesta del HTTP: "+response.getStatus());