Skip to content

Instantly share code, notes, and snippets.

View gonzaleztroyano's full-sized avatar
💻
Tech Time!

Pablo González Troyano gonzaleztroyano

💻
Tech Time!
View GitHub Profile
@gonzaleztroyano
gonzaleztroyano / AmazonCodewhisper.html
Last active March 19, 2025 10:10
Archivos generados con IA para la práctica 2 de Servicios Móviles y Ubicuos
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Interactive Dictionary</title>
<style>
body {
font-family: 'Arial', sans-serif;
margin: 0;
@gonzaleztroyano
gonzaleztroyano / get-form.php
Created January 30, 2024 16:00
Diferencia GET vs. POST
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GET Form</title>
</head>
<body>
<h2>GET Form</h2>
<form action="process.php" method="get">
@gonzaleztroyano
gonzaleztroyano / hubspot-task-scheduler.py
Last active March 15, 2025 19:10
This script, executed as a cron job, enables the generation of scheduled tasks in HubSpot CRM (even using the free version, on which it is not natively supported). Essentially, the script uses the HubSpot HTTP API to perform task creation requests (engagements).
# This script, executed as a cron job, enables the generation of scheduled tasks in HubSpot CRM (even using the free version, on which it is not natively supported).
#
# All the variables that need to be changed are indicated as "XXXXXXXXXX" in the code below. Essentially, the script uses the HubSpot HTTP API to perform task creation requests (engagements).
# All the API documentation is available here: https://developers.hubspot.com/docs/api/overview
# For in-deep task creation via API documentation, check: https://developers.hubspot.com/docs/api/crm/tasks
#
# The HTTP request is sent using “requests” via POST, combining the details of the tasks and the authorization and content-type headers.
#
# The script has saved into the ‘task’ object different variables for each configured task. For instance, task1 has a title starting with ‘informe’ and an association with another object (a person, in this case). task2 has no association configured.
# To add more tasks, just edit the “task” object, with a name
async function handleRequest(stop_requested) {
if (stop_requested > 1 && stop_requested < 99999) {
console.log("OK - " + stop_requested)
const destinationURL = 'https://www.emtmadrid.es/PMVVisor/pmv.aspx?stopnum=' + stop_requested + '&size=3&utm_source=pglez';
return Response.redirect(destinationURL, 302);
} else {
console.log("NOK - " + stop_requested)
const html = `<html> <head> <meta charset="utf-8"> <title>Visor de tiempos EMT</title> <style>body{font-family: 'Open Sans', 'Helvetica Neue', sans-serif;}img{max-width: 100vw; max-height: 100vw;}</style> </head> <body> <h1>Error en la petición</h1> <h2>Introduzca únicamente el número de parada como parámetro</h2> <br><img src="https://pub-e7a754c25f58400c88dabdb9d5a5b990.r2.dev/banner_emt_glez.png" alt="Imagen de ejemplo"> </body></html>`
return new Response(html, {
headers: {
/**
*
* Alumno: Pablo Gonzalez Troyano
* Grado en Ciencia, Gestion e Ingenieria de Servicios (Semipresencial)
*
* ENUNCIADO DEL EJERCICIO
*
* Un Agricultor se dedica a la cria de Conejos. Compra 240 Conejos aptos para reproducirse.
* Por la experiencia de mas de 20 annos que lleva en el negocio, sabe que cada mes nacen
* entre 2 y 45 conejos jovenes que no estan aptos para reproducirse, pero lo seran
/**
*
* Alumno: Pablo Gonzalez Troyano
* Grado en Ciencia, Gestion e Ingenieria de Servicios (Semipresencial)
*
* ENUNCIADO DEL EJERCICIO
*
* Un agricultor se dedica a la cria de pollos en su finca. Compra 240 pollos,
* gallinas y gallos, aptos para reproducirse. Por la experiencia de mas de 20 annos
* sabe que cada mes nacen entre 2 y 50 pollos. Ademas, mueren ente 1 y 5 pollos.
@gonzaleztroyano
gonzaleztroyano / BE-RIPE-Atlas-measurement-41688561.json
Last active July 4, 2022 20:42
Bash script to save geo-coordinates from several RIPE Atlas probes. Data also provided
{"fw":5020,"mver":"2.2.1","lts":43,"dst_name":"34.140.152.85","af":4,"dst_addr":"34.140.152.85","src_addr":"192.168.10.6","proto":"ICMP","ttl":55,"size":48,"result":[{"rtt":31.469868},{"rtt":31.909145},{"rtt":32.286958}],"dup":0,"rcvd":3,"sent":3,"min":31.469868,"max":32.286958,"avg":31.888657,"msm_id":41688561,"prb_id":1000650,"timestamp":1654959318,"msm_name":"Ping","from":"79.156.126.125","type":"ping","group_id":41688561,"step":null,"stored_timestamp":1654959319}
{"fw":5020,"mver":"2.2.1","lts":43,"dst_name":"34.140.152.85","af":4,"dst_addr":"34.140.152.85","src_addr":"172.18.1.17","proto":"ICMP","ttl":53,"size":48,"result":[{"rtt":28.36906},{"rtt":26.944174},{"rtt":27.921119}],"dup":0,"rcvd":3,"sent":3,"min":26.944174,"max":28.36906,"avg":27.7447843333,"msm_id":41688561,"prb_id":1000961,"timestamp":1654959318,"msm_name":"Ping","from":"83.38.84.45","type":"ping","group_id":41688561,"step":null,"stored_timestamp":1654959321}
{"fw":5040,"mver":"2.4.1","lts":11,"dst_name":"34.140.152.85","af":4,"dst_addr":"3
@gonzaleztroyano
gonzaleztroyano / cloudflare-dynamic-updater.sh
Created January 3, 2022 02:43
Bash Script to dynamically update a DNS record (DDNS) using Cloudflare API
#!/bin/bash
# This script is made to programmatically update a DNS record managed on Cloudflare via its API.
# CC BY 4.0 Pablo González Troyano - 2022
# The script is provided “AS IS” Without warranty of any kind. // Based on cloudflare-ddns-update.sh by Trash2.
# CF API Documentation: https://api.cloudflare.com/
# Update the following variables as needed.
DELIMITER ##
CREATE PROCEDURE ComprobarClientes()
BEGIN
DECLARE C1 CURSOR FOR
SELECT pedidos.cli_no,count(*)
FROM pedidos,clientes
WHERE pedidos.cli_no = clientes.cli_no
AND (clientes.localidad = 'SEVILLA' OR clientes.localidad = 'CADIZ')
AND (pedidos.producto_no BETWEEN 10 AND 30)
RARO
CREATE TABLE IF NOT EXISTS Pedir_Productos (
id INT(2) PRIMARY KEY
);
DELIMITER ##
DROP FUNCTION IF EXISTS productos_vendidos_semana##