Skip to content

Instantly share code, notes, and snippets.

Juan Antonio Breña Moral jabrena

Block or report user

Report or block jabrena

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jabrena
jabrena / MotorEncoderTest.java
Created Sep 3, 2019
Modern syntax for Robots with Java 8+
View MotorEncoderTest.java
package example;
import ev3dev.actuators.lego.motors.EV3LargeRegulatedMotor;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.function.Consumer;
import java.util.stream.Collectors;
@jabrena
jabrena / DonQuijote.java
Last active Aug 19, 2019
DonQuijote.java
View DonQuijote.java
package example.programming;
import ev3dev.robotics.tts.Espeak;
/**
* Java example to show the new language feature (Java 13): Text block
*
* Original text: https://cvc.cervantes.es/literatura/clasicos/quijote/edicion/parte1/cap01/default.htm
*/
public class DonQuijoteDemo {
@jabrena
jabrena / README.md
Last active Jan 23, 2019
API Multiple items affected in a resource
View README.md

API General design:

POST /api/companies/items GET /api/companies/items GET /api/companies/items/{id} DELETE /api/companies/items/{id} PUT /api/companies/items/{id}

PATCH /api/companies/items/

View ThreadDeathCatch.java
public class ThreadDeathCatch {
public static void main(String[] args) {
try {
Thread t = new Thread(() -> {
try {
Thread.sleep(2500);
} catch (Throwable ex) {
System.out.println("Caught in run: " + ex);
}
});
@jabrena
jabrena / MotorEncoderTest.java
Last active Nov 1, 2018
ExecutorService and Motors
View MotorEncoderTest.java
package examples.actuators;
import ev3dev.actuators.lego.motors.EV3LargeRegulatedMotor;
import ev3dev.actuators.lego.motors.Motor;
import lejos.hardware.port.MotorPort;
import lejos.robotics.RegulatedMotor;
import lejos.utility.Delay;
import lombok.extern.slf4j.Slf4j;
import java.util.concurrent.ExecutorService;
View TDD Swagger 1
swagger: "2.0"
info:
description: ""
version: "1.0.0"
title: "TDD Sum"
termsOfService: "http://swagger.io/terms/"
contact:
email: "apiteam@swagger.io"
license:
name: "Apache 2.0"
@jabrena
jabrena / Outuput:
Created Apr 7, 2018
java -jar vmbenchmarks.jar -wi 1 -i 1 -f 1
View Outuput:
robot@ev3dev:~$ java -jar vmbenchmarks.jar -wi 1 -i 1 -f 1
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.openjdk.jmh.util.Utils (file:/home/robot/vmbenchmarks.jar) to field java.io.Console.cs
WARNING: Please consider reporting this to the maintainers of org.openjdk.jmh.util.Utils
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
# JMH version: 1.20
# VM version: JDK 10, VM 10+46-ev3
# VM invoker: /opt/jri-10-build-46-v2/bin/java
# VM options: <none>
@jabrena
jabrena / convertAndVerify.sh
Last active Dec 24, 2017
Convert mp3 from any bitrate to 320; Verify bitrate conversion
View convertAndVerify.sh
#1. Create folder
mkdir 320
#2. Convert any .mp3 to 320 bit rate
for f in *.mp3
do
echo "Processing $f"
ffmpeg -i "$f" -c:a libmp3lame -b:a 320k "./320/$f"
done
View HelloWorld.java
/**
Program description
*/
public class HelloWorld {
public static void main(String[] args) {
//Message
String message = "Hello, World";
// Prints "Hello, World" to the terminal window.
View HelloWorld.java
public class HelloWorld {
public static void main(String[] args) {
// Prints "Hello, World" to the terminal window.
System.out.println("Hello, World");
}
}
You can’t perform that action at this time.