Skip to content

Instantly share code, notes, and snippets.

View KowalczykBartek's full-sized avatar

Bartek Kowalczyk KowalczykBartek

View GitHub Profile
@KowalczykBartek
KowalczykBartek / how to setup secure Dynomite
Last active May 27, 2019 06:39
Dynomite NGINX SSL/TLS Termination
what ?
- As we know Dynomite doesn't support any kind of authentication, so, to make security teams happy, we need to obey this somehow.
One of possibilities is SSL Termination, our Redis client (Jedis for java) will not talk with Dynomite directly but will request NGINX,
NGINX will check client's certificate and if cert is valid, request will be forwarded to Dynomite.
technically how ?
- In normal setup Dynomite requires (for each instance) Dynomite and Redis, in secure setup you will need additionally NGINX,
and this will be only one open port.
With this sample configuration, both Client and Server needs to trust themselves.
photos.flatMap(it -> Observable.from(it))
.delay(1, TimeUnit.SECONDS)
.subscribeOn(AndroidSchedulers.mainThread())
.flatMap(it -> {
view.pictureUploadProgress(it.getPictureType().name()); //to jest ustawienie widoku że wysyłam it element
client.uploadDriverPicture(reservationId, pictureInput) //to jest observable który wykonuje potem zapytanie i zwraca response
.subscribeOn(Schedulers.io()) // na tym wątku muszę wykonać zapytanie sieciowe
.observeOn(AndroidSchedulers.main()) //na tym wątku mogę robić update widoku, ale nie chcę tego robić tutaj
.doOnNext(response -> {})
Observable.just(1, 2, 3, 4, 5)//
.map(c -> {
System.out.println("1 " + Thread.currentThread().getName());
return c;
})//
.flatMap(a -> {
return Observable.just(1) //
.observeOn(Schedulers.io())//
.map(b -> b)//
Observable.just(1, 2, 3, 4, 5)//
.map(c -> {
System.out.println("1 " + Thread.currentThread().getName());
return c;
})//
.flatMap(a -> {
return Observable.just(1) //
.observeOn(Schedulers.io())//
.map(b -> b)//
char* adasidaisdu(char **args, int argc)
{
char* szukaj = "-d";
int i=1; //omit 0 - due to 0 is application name itself
for(i = 1; i < argc; i++)
{
if(strcmp(decompressionFlag, args[i]) == 0)
{
int sprawdzanie_argumentow(char** argv,char* argument)
{
int b = 1;
while ( b < 8 ){
if (strcmp(argv[b],argument) == 0){
printf("ARGV %s\n",argv[b]);
return 0;
}
else{
@KowalczykBartek
KowalczykBartek / java
Created December 27, 2015 21:20
sample of rxjava repeatWhen
public static void main(String... args) {
AtomicInteger a = new AtomicInteger();
Observable.just(1, 2, 3, 4, 5, 6, 7, 8)
.repeatWhen(notification -> {
return notification.flatMap(o -> {
System.out.println("'repeatWhen'");
if(a.getAndAdd(1) < 10){
return Observable.just(o).delay(1,TimeUnit.SECONDS);
@KowalczykBartek
KowalczykBartek / java
Created September 5, 2015 21:52
sample rxJava code
Callable<List<String>> webService1Results1 = () -> {
List<String> result = Arrays.asList("TWEET[3]","TWEET[2]","TWEET[1]");
Thread.sleep(5000);
return result;
};
Callable<List<String>> webService1Results2 = () -> {
List<String> result = Arrays.asList("POST[3]","POST[2]","POST[1]");
Thread.sleep(5000);
return result;
};
interface LoggerAwarenessController {
default Logger getLogger(){
return LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
}
}
<div id="ID-WIADOMOSCI" class="custom-msg-class">
Tutaj tresc wiadomosci
</div>