Skip to content

Instantly share code, notes, and snippets.


Mateusz Mrozewski mateuszmrozewski

View GitHub Profile
View gist:e6836d9dc6dd05b14761aa3081112e5b
journalctl -k | grep -i -e memory -e oom
List.of(1, 2, 3, 3, 3, 4).stream()
mateuszmrozewski /
Created Aug 16, 2019
Example of functional interfaces in streams
Stream.generate(() -> Math.random())
.mapToLong(x -> (long) (x * 10))
.filter(x -> x % 2 == 0)
mateuszmrozewski /
Created Feb 4, 2019
SSE-S3 example with header
PutObjectRequest putRequestUnencrytped = PutObjectRequest.builder()
client.putObject(putRequestUnencrytped, Paths.get("my-file.png"));
mateuszmrozewski /
Last active Jan 5, 2019
Uploading and downloading file from S3 using SSE-C
// 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");
byte[] digest = md5.digest();
View gist:a1c8447354aba8300a678ffde53d4281
sudo wget -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
View Open files limit OSX
sysctl -w kern.maxfiles=20480
sysctl -w kern.maxfilesperproc=18000
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", "");
args.put("x-dead-letter-queue", "dl.queue");
return Arrays.asList(
mateuszmrozewski / Remove docker images and containers
Last active Feb 26, 2017
Remove docker images and containers
View Remove docker images and containers
# 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
View Scala problem 19
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)