This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git clone [email protected]:exolever/exolever.git | |
git clone [email protected]: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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#comando para UNIX | |
curl -s --data "[email protected]&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 "[email protected]&pass=TUPASSWORD" https://vpn.ugr.es | perl -n -e '/cgi.*&p=(.{0,12})/ && print $1' | pbcopy | |
pbpaste | |
echo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Dadas 2 colas con elementos repetidos (y ordenados) implementar la función queue<int> multiinterseccion (queue<int> q1, queue<int> q2) que calcule la multi intersección de 2 colas que y q2 y devuelva el resultado en otra cola. | |
// q1=[2,2,3,3] | |
// q2=[1,2,3,3,4] | |
// multi intersección=[2,3,3] | |
queue<int> multiinterseccion (queue<int> q1, queue<int> q2) | |
{ | |
queue<int> multi, q2aux; | |
while(!q1.empty()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Diseñar una función que dada una lista L devuelva otra lista R conteniendo los elementos repetidos de L. Si no hay elementos repetidos R será la lista vacía. | |
// L = [5, 2, 7, 2, 5, 1] | |
// R = [5, 2] | |
list<int> repetidos(list<int> L) | |
{ | |
list<int> R; | |
for (list<int>::iterator it1 = L.begin(); it1!=L.end(); ++it1) | |
for (list<int>::iterator it2 = L.begin(); it2!=L.end(); ++it2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Diseñar una función booleana que devuelva true si en una expresión matemática los paréntesis, corchetes y llaves están colocados de forma correcta (a cada símbolo abierto le corresponde uno cerrado del mismo tipo) | |
// Codigo basado en una solución parecida encontrada en stackoverflow | |
bool pareados(char abre,char cierra) | |
{ | |
bool pareado = false; | |
if(abre == '(' && cierra == ')') | |
pareado = true; | |
else if(abre == '{' && cierra == '}') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****************************************************************************** | |
* | |
* 2015 - Ernesto Serrano <[email protected]> | |
* --------------------------------------------- | |
* | |
* Fichero auxiliar para pintar colores en la consola | |
* | |
******************************************************************************/ | |
#ifndef __Color_h__ |
NewerOlder