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 ReactDemo { | |
public static void main(String[] args) { | |
Flux.range(1,0) | |
.doOnNext(System.out::println) | |
.count().doOnNext(size -> { | |
if (size == 0) { | |
System.out.println("Size is: " + size); | |
} | |
}).subscribe(); |
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
@PostMapping(path = "/request-part/employee/object", consumes = { MediaType.MULTIPART_FORM_DATA_VALUE }) | |
public Person requestPartObject(@RequestPart Person employee, @RequestPart MultipartFile document) { | |
return employee; | |
} | |
public record Person (String name, String address) {} |
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 com.github.rbaul.rate_limit; | |
import lombok.AllArgsConstructor; | |
import lombok.Builder; | |
import lombok.Getter; | |
import lombok.NoArgsConstructor; | |
import lombok.Setter; | |
import org.springframework.util.CollectionUtils; | |
import java.util.HashMap; |
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
Map<String, Object> map = new HashMap(); | |
for(Iterator it = ((AbstractEnvironment) env).getPropertySources().iterator(); it.hasNext(); ) { | |
PropertySource propertySource = (PropertySource) it.next(); | |
if (propertySource instanceof MapPropertySource) { | |
map.putAll(((MapPropertySource) propertySource).getSource()); | |
} | |
} | |
return map; |
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
/etc # cat passwd | grep "/bin/ash" | |
root:x:0:0:root:/root:/bin/ash | |
task-executor:x:1000:1000:Linux User,,,:/home/task-executor:/bin/ash | |
/etc # sed -i 's+/bin/ash+/bin/sh+g' passwd | |
/etc # cat passwd | grep "/bin/ash" | |
/etc # cat passwd | grep "/bin/sh" | |
root:x:0:0:root:/root:/bin/sh | |
task-executor:x:1000:1000:Linux User,,,:/home/task-executor:/bin/sh | |
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
/** | |
* Example of use | |
*/ | |
public static void main(String[] args) throws IOException { | |
byte[] tarByte = Files.readAllBytes(Paths.get("some.tar.gz")); | |
String tar = Base64.getEncoder().encodeToString(tarByte); | |
} |
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
@RabbitListener(bindings = @QueueBinding( | |
value = @Queue(value = "QUEE_NAME", | |
durable = "true", | |
arguments = { | |
@Argument(name = "x-single-active-consumer", value = "true", type = "java.lang.Boolean") | |
} | |
), | |
exchange = @Exchange(value = "EXCHANGE_NAME", type = ExchangeTypes.TOPIC), | |
key = { | |
"ROUTE_KEY_1", |
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 RabbitListenerConfiguration { | |
@Autowired | |
public void rabbitListenerContainerFactory( | |
@Qualifier(RabbitListenerAnnotationBeanPostProcessor.DEFAULT_RABBIT_LISTENER_CONTAINER_FACTORY_BEAN_NAME) SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory, | |
ObjectMapper objectMapper) { | |
rabbitListenerContainerFactory.setMessageConverter(new Jackson2JsonMessageConverter(objectMapper)); | |
} | |
} |
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
C:\"Program Files"\AdoptOpenJDK\jdk-15.0.2.7-openj9\bin\jlink --module-path C:\"Program Files"\AdoptOpenJDK\jdk-15.0.2.7-openj9\jmods --verbose --add-modules java.base,java.logging,java.compiler,java. | |
scripting,java.xml,jdk.net,jdk.jdwp.agent,java.sql,jdk.unsupported,java.naming,java.desktop,java.management,java.security.jgss,java.instrument,jdk.management.agent,jdk.localedata,openj9.sharedclasses,jdk.naming.dns,jdk.jcmd,java.sql | |
.rowset,jdk.crypto.cryptoki,jdk.crypto.ec --output jdk-minimal | |
// Install | |
https://adoptopenjdk.net/releases.html?variant=openjdk15&jvmVariant=openj9 | |
// Create new JDK | |
C:\"Program Files"\AdoptOpenJDK\jdk-15.0.2.7-openj9\bin\jlink --module-path C:\"Program Files"\AdoptOpenJDK\jdk-15.0.2.7-openj9\jmods --verbose --add-modules java.base,java.compiler,java.datatransfer,java.desktop,java.instrument,java.logging,java.management,java.management.rmi,java.naming,java.net.http,java.prefs,java.rmi,java.scripting,java.se,java.security.jgss,java.security.sasl,java.smartcardio,java.sql,java.sql. |
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
Instead of environment variables, like myProperty, please use Gradle properties | |
they can be specified in the gradle.properties file, if not secret. | |
For more vulnerable data or properties that may change when running tasks, | |
you can set such properties using environment variables prefixed with | |
ORG_GRADLE_PROJECT_ | |
example: ORG_GRADLE_PROJECT_myProperty |
NewerOlder