Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am berserkk on github.
  • I am berserkk (https://keybase.io/berserkk) on keybase.
  • I have a public key ASAZPzswhSEydipw_U5lN743rfS7JW0s250a0-vBmFousAo

To claim this, I am signing this object:

@berserkk
berserkk / main.go
Created Oct 17, 2018
Golang long polling example with request cancellation
View main.go
package main
import (
"context"
"fmt"
"net/http"
"time"
)
func longOperation(ctx context.Context, ch chan<- string) {
@berserkk
berserkk / main.go
Created Oct 17, 2018
Golang long polling example
View main.go
package main
import (
"fmt"
"net/http"
"time"
)
func longOperation(ch chan<- string) {
// Simulate long operation.
@berserkk
berserkk / Main.java
Last active Jul 31, 2018
Simple example of compressing HTTP request via gzip with using Spring RestTemplate
View Main.java
import org.springframework.http.HttpMethod;
import org.springframework.http.client.ClientHttpRequest;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.HttpMessageConverterExtractor;
import org.springframework.web.client.RequestCallback;
import org.springframework.web.client.ResponseExtractor;
import org.springframework.web.client.RestTemplate;
import java.io.IOException;
import java.nio.charset.StandardCharsets;