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
journalctl -k | grep -i -e memory -e oom |
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
List.of(1, 2, 3, 3, 3, 4).stream() | |
.distinct() | |
.forEach(System.out::println); |
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
Stream.generate(() -> Math.random()) | |
.mapToLong(x -> (long) (x * 10)) | |
.filter(x -> x % 2 == 0) | |
.limit(10) | |
.forEach(System.out::println); |
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
PutObjectRequest putRequestUnencrytped = PutObjectRequest.builder() | |
.bucket("myunencrypted-bucket") | |
.key("my-file.png") | |
.serverSideEncryption(ServerSideEncryption.AES256) | |
.build(); | |
client.putObject(putRequestUnencrytped, Paths.get("my-file.png")); |
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
// Generate a random 256 bit AES key and encode it in Base64 | |
KeyGenerator keyGenerator = KeyGenerator.getInstance("AES"); | |
keyGenerator.init(256, new SecureRandom()); | |
SecretKey secretKey = keyGenerator.generateKey(); | |
String secretKeyString = Base64.getEncoder().encodeToString(secretKey.getEncoded()); | |
// Generate md5 digest of the key and encode it in Base64 | |
MessageDigest md5 = MessageDigest.getInstance("MD5"); | |
md5.update(secretKey.getEncoded()); | |
byte[] digest = md5.digest(); |
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
sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo | |
sudo sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo | |
sudo yum install -y apache-maven | |
mvn --version |
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
sysctl -w kern.maxfiles=20480 | |
sysctl -w kern.maxfilesperproc=18000 |
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
@Bean | |
public List<Declarable> queueDeclarations() | |
{ | |
boolean durable = true; | |
boolean autoDelete = false; | |
boolean exclusive = false; | |
Map<String, Object> args = new HashMap<>(); | |
args.put("x-dead-letter-exchange", "dl.exchange"); | |
args.put("x-dead-letter-queue", "dl.queue"); | |
return Arrays.asList( |
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 | |
# Delete all containers | |
docker rm -f $(docker ps -a -q) | |
# Delete all images | |
docker rmi -f $(docker images -q) | |
# Delete dangling volumes | |
docker volume ls -qf dangling=true | xargs -r docker volume rm |
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
object S99_P19 { | |
def rotate[T](n: Int, ts: Seq[T]): Seq[T] = (n, ts) match { | |
case (_, Nil) => Nil | |
case (0, seq) => seq | |
case (x, seq) => rotate(x - 1, seq.last +: seq take seq.length - 1) | |
} | |
} |
NewerOlder