Skip to content

Instantly share code, notes, and snippets.

View erseco's full-sized avatar
💭
dG9udG8gZWwgcXVlIGxvIGxlYQ==

Ernesto Serrano erseco

💭
dG9udG8gZWwgcXVlIGxvIGxlYQ==
View GitHub Profile
@erseco
erseco / loteria.js
Created December 21, 2023 21:21
Comprobador loteria navidad 2023 con la web de rtve en javascript
//
// Comprobador de la loteria de navidad
//
// Ve a https://www.rtve.es/loterias/loteria-navidad/buscador/ abre la consola javascript del navegador y pega este código
//
// Lista de números y cantidades
const numeros = [
{ numero: "12345", cantidad: "20" },
{ numero: "54321", cantidad: "1" },
// ... Añade más números y cantidades (sin decimales) aquí
/*
How to Use this Script in WordPress Multisite from the Browser Console
----------------------------------------------------------------------
1. Open the Site Creation Page: Log in to your WordPress Multisite network admin dashboard and navigate to the page where you add new sites.
2. Open the Browser Console: Right-click anywhere on the page and select "Inspect" or "Inspect Element", then go to the "Console" tab.
3. Paste the Script: Copy the entire script above and paste it into the console.
4. Execute the Script: Press Enter to run the script. It will start creating sites based on the user names defined in the users array.
@erseco
erseco / playlist-extractor.js
Created December 11, 2023 22:06
YouTube Studio Playlist URL and Title Extractor
// YouTube Studio Playlist URL and Title Extractor
// This script is designed to run in the browser console while you're on the YouTube Studio playlist page.
// It extracts the URLs and titles of all playlists in the current view. The script is particularly useful
// for channel managers and content creators who need to quickly gather information about their playlists
// for cataloging, backup, or analysis purposes.
// How It Works:
// - The script queries the document for all anchor (<a>) elements that contain '/playlist/' in their href attribute.
@erseco
erseco / cas.sh
Last active September 22, 2023 11:48
This script automates authentication for systems using Apereo CAS (Central Authentication Service). It logs in via command-line, useful for tasks/testing. More on Apereo CAS: github.com/apereo/cas
#!/bin/bash
# Usage: cas.sh {url} {username} {password}
# If you have any errors, try removing the redirects to get more information.
# Encode the destination URL using curl
DEST="${1}"
ENCODED_DEST=$(curl -Gso /dev/null -w %{url_effective} --data-urlencode "" "${DEST}" | cut -d'?' -f2)
# CAS server details
@erseco
erseco / calculadora.c
Created April 19, 2021 18:38
Ejercicio de las oposiciones informatica andalucía 2018
#include <stdio.h>
/* Función para sumar, acepta dos valores de entrada y devolverá el resultado de la operación */
int sumar(int, int);
/* Función para restar, acepta dos valores de entrada y devolverá el resultado de la operación */
int restar(int, int);
/* Función para multiplicar, acepta dos valores de entrada y devolverá el resultado de la operación */
int multiplicar(int, int);
@erseco
erseco / sorteo.c
Last active May 12, 2022 11:09
Código para realizar el sorteo de bolas de una oposición a Profesor de Enseñanza Secundaria, Especialidad Informática
// Código para realizar el sorteo de bolas de una oposición a Profesor de Enseñanza Secundaria, Especialidad Informática
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
// Colores ansi para la consola
#define BLACK "\033[0m"
#define RED "\033[31m"
#define GREEN "\033[32m"
@erseco
erseco / merge.sh
Created September 5, 2019 18:17
Merge two repositories maintaining history
git clone git@bitbucket.org:exolever/exolever.git
git clone git@bitbucket.org:exolever/exo-services.git
cd exolever
mkdir service-exo-core
git mv !(service-exo-core) service-exo-core
git commit -a -S -m "Moving exolever into its own subdirectory (service-exo-core)"
cd ../exo-services
@erseco
erseco / gist:2c0b5097fd87d26aea2e
Created March 9, 2016 17:29
Comando para obtener el password temporal de la vpn de la ugr mediante la linea de comandos
#comando para UNIX
curl -s --data "user=XXXXX@correo.ugr.es&pass=TUPASSWORD" https://vpn.ugr.es | perl -n -e '/cgi.*&p=(.{0,12})/ && print "$1\n"'
#comando para MACOSX que además copia el password en el portapapeles
curl -s --data "user=XXXXX@correo.ugr.es&pass=TUPASSWORD" https://vpn.ugr.es | perl -n -e '/cgi.*&p=(.{0,12})/ && print $1' | pbcopy
pbpaste
echo
actions <- c("N", "S", "E", "W")
x <- 1:4
y <- 1:3
rewards <- matrix(rep(0, 12), nrow=3)
rewards[2, 2] <- NA
rewards[1, 4] <- 1
rewards[2, 4] <- -1
// Diseñar una función orden int orden(list<int> L) que devuelva 1 si L está ordenada de forma ascendente de principio a fin, 2 si lo está de forma descendente y 0 si no está ordenada de ninguna forma.
int orden(list<int> L)
{
int resultado = 0;
list<int>::iterator it = L.begin();
int ant = *it;
++it;