Skip to content

Instantly share code, notes, and snippets.

View alexeyryzhikov's full-sized avatar

Alexey Ryzhikov alexeyryzhikov

View GitHub Profile
@alexeyryzhikov
alexeyryzhikov / notes.txt
Last active November 19, 2020 15:30
Microservice Notes
GOTO 2014 • Microservices • Martin Fowler
https://www.youtube.com/watch?v=wgdBVIX9ifA
https://www.youtube.com/watch?v=GBTdnfD6s5Q
GOTO 2020 • When To Use Microservices (And When Not To!) • Sam Newman & Martin Fowler
https://www.youtube.com/watch?v=9I9GdSQ1bbM
GOTO 2019 • Monolith Decomposition Patterns • Sam Newman
https://www.youtube.com/watch?v=57UK46qfBLY
@alexeyryzhikov
alexeyryzhikov / Unchecked.java
Created August 18, 2017 11:21
Unchecked exceptions
@SuppressWarnings("unchecked")
public static <T extends Throwable> RuntimeException unchecked(Throwable t) throws T {
throw (T) t;
}
@alexeyryzhikov
alexeyryzhikov / Future.monitor.java
Created April 19, 2017 13:48
Twitter.util Future.monitor example
Promise<String> p1 = new Promise<>();
Function0<Future<String>> mkPromise = Function.ofCallable(() -> {
Promise<String> promise = new Promise<>();
p1.onSuccess(Function.cons(res -> {
// Thrown exception will be caught by Monitor.catcher (see Promise.Monitored.apply)
Throwables.propagate(new NullPointerException());
promise.setValue("Done");
}));
@alexeyryzhikov
alexeyryzhikov / NotificationListener.java
Created October 28, 2016 10:01
Notification Service implementation
package com.greenwave.training.monitoring.rest.service;
import com.greenwave.training.monitoring.rest.dto.MonitorMessage;
public interface NotificationListener {
void onMessage(MonitorMessage message);
}
INFO 10:04:28 Harmless error reading saved cache /home/alexey/dev/projects/axon/tools/apache-cassandra-3.7/bin/../data/saved_caches/KeyCache-e.db
java.lang.RuntimeException: Cache schema version 16099a89-2b3f-3d98-b191-e277722750a0 does not match current schema version f1450460-2d02-35f8-aae4-8ef34ad1bcb4
at org.apache.cassandra.cache.AutoSavingCache.loadSaved(AutoSavingCache.java:200) ~[apache-cassandra-3.7.jar:3.7]
at org.apache.cassandra.cache.AutoSavingCache$3.call(AutoSavingCache.java:159) [apache-cassandra-3.7.jar:3.7]
at org.apache.cassandra.cache.AutoSavingCache$3.call(AutoSavingCache.java:155) [apache-cassandra-3.7.jar:3.7]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_111]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_111]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_111]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_111]
INFO 10:04:28 Completed loading (8 ms; 1
@alexeyryzhikov
alexeyryzhikov / BatchingComponent.java
Created October 28, 2016 03:43
BatchingComponent
@Component
class BufferComponent<T>{
private transient List<Message<T>> buffer;
@Inject
private Config config;
@Output
private Out<List<T>> output;
import sys
import socket
import datetime
import time
from threading import Thread
def get_host_and_port():
args = sys.argv
arg_count = len(args)
root@pve:/raid-pool# cat /proc/meminfo
MemTotal: 65917384 kB
MemFree: 21318560 kB
MemAvailable: 21319668 kB
Buffers: 5316 kB
Cached: 148020 kB
SwapCached: 6996 kB
Active: 12449036 kB
Inactive: 246540 kB
Active(anon): 12395648 kB
@alexeyryzhikov
alexeyryzhikov / naming.js
Created May 31, 2016 14:18
naming_facepalm.js
_this.isPropertyNameSubstringOfAnotherProperty = function(propertyName) {
var isValid = true;
_.each(_this.configurationProperties, function(propertyValue, propertyKey) {
if (isOneStartOfAnother(propertyName, propertyKey)) {
isValid = false;
}
});
return isValid;
};
@alexeyryzhikov
alexeyryzhikov / KafkaConsumerExample.java
Created April 21, 2016 16:13
KafkaConsumerExample.java
import java.util.Properties;
import com.google.common.base.Charsets;
import com.google.common.collect.ImmutableList;
import org.apache.kafka.clients.CommonClientConfigs;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.consumer.ConsumerRecords;
import org.apache.kafka.clients.consumer.KafkaConsumer;