Skip to content

Instantly share code, notes, and snippets.

Avatar
🔨
forging testkube

Jacek Wysocki exu

🔨
forging testkube
View GitHub Profile
@exu
exu / fssse.go
Created Nov 9, 2021 — forked from dudochkin-victor/fssse.go
fasthttp sse
View fssse.go
package main
import (
"bufio"
"fmt"
"log"
"time"
"github.com/valyala/fasthttp"
)
View keybase.md

Keybase proof

I hereby claim:

  • I am exu on github.
  • I am ex00 (https://keybase.io/ex00) on keybase.
  • I have a public key ASA64vm8QItIOkLbBvBbpHqRQpNnxmEISrW2qI2QVFw2EQo

To claim this, I am signing this object:

View keybase.md

Keybase proof

I hereby claim:

  • I am exu on github.
  • I am ex00 (https://keybase.io/ex00) on keybase.
  • I have a public key ASDPy0ZW9L2wtGYzcic-fjJZNr0sXSLKeaiu5mXV8tlhsgo

To claim this, I am signing this object:

@exu
exu / 00_destructuring.md
Created Oct 15, 2020 — forked from john2x/00_destructuring.md
Clojure Destructuring Tutorial and Cheat Sheet
View 00_destructuring.md

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences

@exu
exu / sse.go
Created Jun 15, 2020 — forked from schmohlio/sse.go
Example SSE server in Golang
View sse.go
// v2 of the great example of SSE in go by @ismasan.
// includes fixes:
// * infinite loop ending in panic
// * closing a client twice
// * potentially blocked listen() from closing a connection during multiplex step.
package main
import (
"fmt"
"log"
View bash.generate.random.alphanumeric.string.sh
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
@exu
exu / RestConfiguration.java
Created Sep 3, 2019 — forked from ripla/RestConfiguration.java
The different ways of accessing a REST HATEOAS resource created with Spring Data. Using a Spring RestTemplate.
View RestConfiguration.java
import java.util.Arrays;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.hateoas.MediaTypes;
import org.springframework.hateoas.hal.Jackson2HalModule;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.client.RestTemplate;
@exu
exu / nginx-tuning.md
Created Jul 13, 2017 — forked from denji/nginx-tuning.md
NGINX tuning for best performance
View nginx-tuning.md

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

View rateliimt.go
rate := time.Second / 10 // 10 requests a second
limit := time.Tick(rate)
for req := range messages {
<-limit
go makeRequest(req)
}
@exu
exu / sysctl.conf
Created Nov 3, 2016 — forked from kgriffs/sysctl.conf
Linux Web Server Kernel Tuning
View sysctl.conf
# Configuration file for runtime kernel parameters.
# See sysctl.conf(5) for more information.
# See also http://www.nateware.com/linux-network-tuning-for-2013.html for
# an explanation about some of these parameters, and instructions for
# a few other tweaks outside this file.
# Protection from SYN flood attack.
net.ipv4.tcp_syncookies = 1