This file contains 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
await fetch("http://localhost:8000/imprimir_en", { | |
method: "POST", | |
body: JSON.stringify({ | |
impresora: "TEST", | |
operaciones: [{accion: "write", datos: "Datos de prueba\n\nSalto de linea\n"}] | |
}) | |
}) |
This file contains 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
/* | |
Cliente HTTP en Go con net/http | |
Ejemplo de petición HTTP Get en Golang | |
@author parzibyte | |
*/ | |
package main | |
import ( | |
"io/ioutil" | |
"log" |
This file contains 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
package main | |
import ( | |
"encoding/json" | |
"flag" | |
"fmt" | |
"log" | |
"net/http" | |
"strings" | |
) |
This file contains 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
public static int minimoComunMultiplo(int a, int b) { | |
// Y ahora aplicamos la fórmula que dice: | |
// MCM(a, b) = (a * b) / MCD(a, b) | |
return (a * b) / maximoComunDivisor(a, b); | |
} |
This file contains 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
public static int maximoComunDivisor(int a, int b) { | |
int temporal;//Para no perder b | |
while (b != 0) { | |
temporal = b; | |
b = a % b; | |
a = temporal; | |
} | |
return a; | |
} |
This file contains 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
public class Main { | |
public static void main(String[] args) { | |
int a = 50; | |
int b = 120; | |
int mcd = maximoComunDivisor(a, b); | |
System.out.printf("El MCD de %d y %d es %d\n", a, b, mcd); | |
int mcdRecursivo = maximoComunDivisorRecursivo(a, b); | |
System.out.printf("El MCD de %d y %d (con recursividad) es %d\n", a, b, mcdRecursivo); | |
} |
This file contains 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
public static int maximoComunDivisorRecursivo(int a, int b) { | |
if (b == 0) return a; | |
return maximoComunDivisorRecursivo(b, a % b); | |
} |
This file contains 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
public static int maximoComunDivisor(int a, int b) { | |
int temporal;//Para no perder b | |
while (b != 0) { | |
temporal = b; | |
b = a % b; | |
a = temporal; | |
} | |
return a; | |
} |
This file contains 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
/* | |
____ _____ _ _ _ | |
| _ \ | __ \ (_) | | | | |
| |_) |_ _ | |__) |_ _ _ __ _____| |__ _ _| |_ ___ | |
| _ <| | | | | ___/ _` | '__|_ / | '_ \| | | | __/ _ \ | |
| |_) | |_| | | | | (_| | | / /| | |_) | |_| | || __/ | |
|____/ \__, | |_| \__,_|_| /___|_|_.__/ \__, |\__\___| | |
__/ | __/ | | |
|___/ |___/ |
This file contains 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
public static void main(String[] args) { | |
String originalText = "parzibyte.me"; | |
System.out.println("Original text: " + originalText); | |
String translatedText = textToBinary(originalText); | |
System.out.println("In binary, it is: " + translatedText); | |
System.out.println("-----------------"); | |
NewerOlder