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
import cloud.localstack.utils.PromiseAsyncHandler; | |
import com.amazon.sqs.javamessaging.SQSConnection; | |
import com.amazon.sqs.javamessaging.SQSConnectionFactory; | |
import com.amazonaws.auth.AWSStaticCredentialsProvider; | |
import com.amazonaws.services.sqs.AmazonSQS; | |
import com.amazonaws.services.sqs.AmazonSQSAsync; | |
import com.amazonaws.services.sqs.model.*; | |
import com.amazonaws.services.sqs.model.Message; | |
import org.junit.Assert; | |
import org.junit.BeforeClass; |
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
You are designing a compiler for a C++ program and need to check that braces in any given file are balanced. | |
Braces in a string are considered to be balanced if the following criteria are met: | |
All braces must be closed. Braces come in pairs of the form (), {} and []. The left brace opens the pair, and the right one closes it. | |
In any set of nested braces, the braces between any pair must be closed. | |
For example, [{}] is a valid grouping of braces but [{]} is not. | |
Function Description | |
Complete the function braces in the editor below. The function must return an array of strings where the string at each index i denotes whether or not the braces were balanced in values[i]. The array should consist of strings YES or NO aligned with their indices in values. |
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
docker run --ulimit memlock=-1:-1 -it --rm=true --memory-swappiness=0 \ | |
--name postgres-quarkus-rest-http-crud -e POSTGRES_USER=restcrud \ | |
-e POSTGRES_PASSWORD=restcrud -e POSTGRES_DB=rest-crud \ | |
-p 5432:5432 postgres:10.5 |
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 CollectionUtil { | |
/** | |
* Distinct by multiple fields – distinctByKeys() function | |
* | |
* <PRE> | |
* List<Record> list = recordsList.stream() | |
* .filter(distinctByKeys(Record::getId, Record::getName)) | |
* .collect(Collectors.toList()); | |
* </PRE> |
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
/** | |
* Import on top of app.module.ts to use across the application | |
* | |
* import './shared/utils/date.prototype.extendions'; | |
*/ | |
declare global { | |
interface Date { | |
addDays(days: number, useThis?: boolean): Date; | |
addSeconds(seconds: number): Date; |
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
# tab with 2 spaces | |
autocmd FileType yaml setlocal ai ts=2 sw=2 et |
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
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; | |
public class Password { | |
public User changePassword(String newClearPassword) { | |
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); | |
if (!passwordEncoder.matches(newClearPassword, this.getPassword())) { | |
throw new InvalidPasswordException(); | |
} |
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
#!/bin/bash | |
export TKN=$(curl -X POST 'http://localhost:8080/auth/realms/master/protocol/openid-connect/token' \ | |
-H "Content-Type: application/x-www-form-urlencoded" \ | |
-d "username=admin" \ | |
-d 'password=admin' \ | |
-d 'grant_type=password' \ | |
-d 'client_id=admin-cli' | jq -r '.access_token') | |
curl -X GET 'http://localhost:8080/auth/admin/realms' \ |
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
# switch the log level to DEBUG on console | |
{wildfly}/bin/jboss-cli.sh --connect | |
[standalone@localhost:9990 /] /subsystem=logging/console-handler=CONSOLE:write-attribute(name=level,value=DEBUG) | |
[standalone@localhost:9990 /] /subsystem=logging/root-logger=ROOT:write-attribute(name=level,value=DEBUG) | |
# switch it back to whatever it was initial configuration (here it is INFO) | |
[standalone@localhost:9990 /] /subsystem=logging/console-handler=CONSOLE:write-attribute(name=level,value=INFO) | |
[standalone@localhost:9990 /] /subsystem=logging/root-logger=ROOT:write-attribute(name=level,value=INFO) |
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 matera.spi.messaging; | |
import org.mockito.Mockito; | |
import java.lang.reflect.Field; | |
/** | |
Example to use: | |
<PRE> |