Skip to content

Instantly share code, notes, and snippets.

View hernandohhoyos's full-sized avatar

Hernando Hurtado Hoyos hernandohhoyos

  • I currently work at LF Technologies
  • Colombia
  • 05:01 (UTC -05:00)
View GitHub Profile
@hernandohhoyos
hernandohhoyos / schemeless.sql
Created February 1, 2026 07:06
SQL: Schemeless Data Storage in PostgreSQL
/*
* Approach: Schemeless Data Storage in PostgreSQL
*
* This implementation utilizes the JSONB data type to achieve a schemeless (document-oriented)
* architecture within a relational database.
*
* Advantages:
* - Schema Flexibility: Allows storing diverse data structures without migrations.
* - Development Speed: Faster iteration during early-stage development.
* - Dynamic Attributes: Easily handle entities with unpredictable or sparse fields.
@hernandohhoyos
hernandohhoyos / blockchained_audit_log.sql
Last active February 1, 2026 20:59
SQL: Audit Log Using BlockChain
/*
* Audit logging implementing blockchain-inspired principles. ( Postgres 18 ).
*
* This system ensures data integrity and traceability by chaining transaction logs
* through cryptographic hashing.
*
* Advantages:
* - High Integrity: Each log entry is linked to the previous one, making tampering detectable.
* - Traceability: Complete history of changes (snapshots/deltas) for auditing and recovery.
* - Non-repudiation: Provides a verifiable record of operations performed on the database.
@hernandohhoyos
hernandohhoyos / blockchain_simple_vs_hmac.py
Created January 31, 2026 04:18
Blockchain simple vs hmac
import hashlib
import hmac
import time
# Configuración
N_BLOQUES = 10000000
MENSAJE_BASE = "Data_Block_"
# --- 1. GENERACIÓN DE LAS CADENAS ---
from confluent_kafka import TopicPartition, Consumer, Producer
from confluent_kafka.admin import AdminClient
from confluent_kafka.cimpl import NewTopic
message = {"topic": "my-topic", "payload": "mensajito"}
config = {
"producer_config": {
"bootstrap.servers": "broker:port,broker:port",
"security.protocol": "SSL",
},
@hernandohhoyos
hernandohhoyos / Android_commands.sh
Last active August 7, 2024 18:59
Comandos útiles para trabajar con Android
# Para las keystore que piden Android
keytool -genkey -v -keystore task.keystore -keyalg RSA -keysize 2048 -validity 10000 -alias tasks -storepass android -keypass android
keytool -genkey -v -keystore task.jks -keyalg RSA -keysize 2048 -validity 10000 -alias tasks
# Para virtualizar Android
avdmanager create avd -n MyAVD -k "system-images;android-30;google_apis;x86_64" -d pixel
# Instalar apks en el emulador
adb install H:/Game/proyectos/lista_de_tareas/tasks.apk
@hernandohhoyos
hernandohhoyos / godot_sqlite.gd
Created August 6, 2024 22:55
Base de datos con SQLite en Godot 4.2.2
extends Control
# Referencias a los nodos ItemList y Button
@onready var item_list = $ItemList
@onready var add_button = $Button
var db : SQLite # usando el addon godot-sqlite
# Called when the node enters the scene tree for the first time.
func _ready():
@hernandohhoyos
hernandohhoyos / calculate_neigbor_vector.py
Created August 1, 2024 18:02
Calcular la posición de un segundo punto en un espacio 2D dados un punto inicial, una distancia, un eje, una altura y un ángulo
import math
import numpy as np
def calculate_neigbor_vector(a, distance, degrees, height=0):
a = np.array(a)
radians = math.radians(degrees)
x2 = a[0] + distance * math.cos(radians)
y2 = a[1] + distance * math.sin(radians)
z2 = a[2] + distance * math.sin(radians) * height
return np.array((x2, y2, z2))
@hernandohhoyos
hernandohhoyos / create_mesh.py
Created August 1, 2024 18:00
Crear una malla en Blender
import bpy
import bmesh
import numpy as np
def create_mesh():
# Elimina todos los objetos en la escena
bpy.ops.object.select_all(action='DESELECT')
bpy.ops.object.select_by_type(type='MESH')
bpy.ops.object.delete()
@hernandohhoyos
hernandohhoyos / calculate_mid_distance.py
Created August 1, 2024 17:52
Calcular el punto medio M de la línea AB
import numpy as np
a = np.array((0,0,0))
b = np.array((1,0,0))
M = ((a[0] + b[0]) / 2, (a[1] + b[1]) / 2, (a[2] + b[2]) / 2)
@hernandohhoyos
hernandohhoyos / calculate_triangle_vectors.py
Created August 1, 2024 17:50
Calcular triángulo en un plano xy con la posibilidad de agregarle altura en z
import numpy
def calculate_triangle_vectors(a, b, distance, height=0):
"""
Calcula un punto con los parámetros dados para formar un triángulo.
:param a: list. Ie (0,0,0)
:param b: list. Ie (0,0,0)
:param distance: float Ie, 1.0
:param height: int. Ie, 1 or -1
"""