Skip to content

Instantly share code, notes, and snippets.

View dfleper's full-sized avatar

Domingo Fleitas dfleper

View GitHub Profile
@dfleper
dfleper / Semaforo.java
Created November 21, 2024 19:23
Example of thread operation. Ejemplo de funcionamiento de hilos.
import java.util.concurrent.Semaphore;
public class Semaforo {
public static void main(String[] args) {
// Crear un semáforo con 3 permisos
Semaphore semaforo = new Semaphore(3);
// Crear una tarea que use el recurso compartido
Runnable tarea = () -> {
String nombreHilo = Thread.currentThread().getName();
@dfleper
dfleper / Inverter.java
Created November 21, 2024 01:21
Inversor de Cadena. String Inverter.
package pack;
import java.util.Scanner;
public class Inverter {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Escribe una cadena de texto: ");
@dfleper
dfleper / Mcd.java
Created November 21, 2024 00:39
Algoritmo de Euclides. Euclid's Algorithm.
package bucle;
import java.util.Scanner;
public class Mcd {
public static void main(String[] args) {
var sc = new Scanner(System.in);
System.out.println("Cálculo del Máximo Común Divisor.");
@dfleper
dfleper / Table.java
Created November 20, 2024 23:35
Tabla de Multiplicar. Multiplication Table.
package bucle;
import java.util.Scanner;
public class Table {
public static void main(String[] args) {
var sc = new Scanner(System.in);
System.out.print("¿Qué tabla de multiplicar necesitas (1-10): ");
@dfleper
dfleper / Switch.java
Created November 20, 2024 23:12
Switch as Expression. Switch como Expresión.
package bucle;
import java.util.Scanner;
public class Switch {
public static void main(String[] args) {
var sc = new Scanner(System.in);
System.out.print("Nota del Alumno: ");
@dfleper
dfleper / Switch.java
Last active November 20, 2024 23:13
Switch as Expression. Switch como Expresión.
package control;
import java.util.Scanner;
public class Switch {
public static void main(String[] args) {
var sc = new Scanner(System.in);
@dfleper
dfleper / index.html
Created November 9, 2024 10:17
Disable right click on the website. Deshabilitar click derecho en la web.
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Disable Right Click</title>
</head>
<body>
<h1>Example of disabling the right button</h1>
<p>Try right-clicking anywhere on this page.</p>