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
// 4 - create CborObject MAP and retrieve Kid and Signature | |
CBORObject messageObject = CBORObject.DecodeFromBytes(outputStream.toByteArray()); | |
byte[] coseSignature = messageObject.get(3).GetByteString(); | |
byte[] protectedHeader = messageObject.get(0).GetByteString(); | |
byte[] content = messageObject.get(2).GetByteString(); | |
byte[] dataToBeVerified = getValidationData(protectedHeader, content); | |
CBORObject unprotectedHeader = messageObject.get(1); | |
byte[] kid = getKid(protectedHeader, unprotectedHeader); | |
// .... |
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
Signature signature = Signature.getInstance("SHA256withECDSA"); | |
signature.initVerify(key); | |
signature.update(dataToBeVerified); | |
coseSignature = ConvertToDer.convertToDer(coseSignature); | |
if (signature.verify(coseSignature)) { | |
System.out.println("Verified"); | |
} else { | |
System.out.println("Not verified"); | |
} |
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
let btn = document.querySelector(".record-btn") | |
btn.addEventListener("click", async function () { | |
let stream = await navigator.mediaDevices.getDisplayMedia({ | |
video: true | |
}) | |
//... | |
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
let btn = document.querySelector("#record-button") | |
btn.addEventListener("click", async function () { | |
let stream = await navigator.mediaDevices.getDisplayMedia({ | |
video: true | |
}) | |
let mediaRecorder = new MediaRecorder(stream, { | |
mimeType: "video/webm" |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Recorder</title> | |
<meta charset="UTF-8"/> | |
</head> | |
<body> | |
<div> | |
<button id="record-button">RECORD</button> | |
</div> |
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
let btn = document.querySelector("#record-button") | |
btn.addEventListener("click", async function () { | |
let stream = await navigator.mediaDevices.getDisplayMedia({ | |
video: true | |
}) | |
let mediaRecorder = new MediaRecorder(stream, { | |
mimeType: "video/webm" |
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
import http from 'k6/http'; | |
import { check, sleep } from 'k6'; | |
import { Trend, Rate } from 'k6/metrics'; | |
const getTrend = new Trend('Get Books'); | |
const getErrorRate = new Rate('Get Books error'); | |
const postTrend = new Trend('Add Book'); | |
const postErrorRate = new Rate('Add Book error'); |
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
// JDBC | |
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE) | |
public ResponseEntity<List<BookDTO>> getAll() { | |
UUID uuid = UUID.randomUUID(); | |
log.info("getAll() {} running", uuid); | |
ResponseEntity<List<BookDTO>> list = ResponseEntity.ok( | |
this.bookRepository.findAll().stream(). | |
map(mapper::toDto).collect(Collectors.toList())); |
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
user nginx; | |
# you must set worker processes based on your CPU cores, nginx does not benefit from setting more than that | |
worker_processes auto; | |
# number of file descriptors used for nginx | |
worker_rlimit_nofile 100000; | |
events { | |
# determines how much clients will be served per worker |
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
// r2dbc | |
public Mono<OrderDTO> addOrder(@RequestParam("bookIsbn") String bookIsbn, @RequestParam("firstName") String firstName) { | |
return Mono.just(UUID.randomUUID()).flatMap(uuid -> { | |
log.info("addOrder() {} running", uuid); | |
Mono<User> user = userRepository.findByFirstName(firstName); | |
Mono<Book> book = bookRepository.findByIsbn(bookIsbn); | |
return Mono.zip(user, book).flatMap(zipFlux -> { | |
log.info("addOrder() {} I've got user and book", uuid); |