Skip to content

Instantly share code, notes, and snippets.

View mohsenk's full-sized avatar
🎯
Focusing

Mohsen Karimi mohsenk

🎯
Focusing
View GitHub Profile
@babanin
babanin / Towards member patterns.md
Last active February 3, 2024 09:48
Towards member patterns

Document copied from here. Authored by Brian Goetz.


Towards member patterns

Time to check in on where things are in the bigger picture of patterns as class members. Note: while this document may have illustrative examples, you should

@mohsenk
mohsenk / nginx-tuning.md
Created March 27, 2018 11:14 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

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.

@int128
int128 / RequestAndResponseLoggingFilter.java
Last active January 13, 2024 10:46
Spring Web filter for logging request and response
/*
Copyright 2017 Hidetake Iwata
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@u1i
u1i / start_docker_registry.bash
Last active March 23, 2024 05:54 — forked from PieterScheffers/start_docker_registry.bash
Start docker registry with letsencrypt certificates and Basic Auth
#!/usr/bin/env bash
# install docker
# https://docs.docker.com/engine/installation/linux/ubuntulinux/
# install docker-compose
# https://docs.docker.com/compose/install/
# install letsencrypt
# https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04
@etiennecarriere
etiennecarriere / DNSPromise.java
Created August 22, 2017 05:53
Usage of Listener on DNSResolver
import java.net.InetSocketAddress;
import io.netty.channel.AddressedEnvelope;
import io.netty.handler.codec.dns.DnsRecord;
import io.netty.handler.codec.dns.DnsResponse;
import io.netty.handler.codec.dns.DnsSection;
import io.netty.util.concurrent.DefaultPromise;
import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.GenericFutureListener;
@mburakerman
mburakerman / package.json
Last active September 26, 2022 17:32
Webpack 4 config.js (SCSS to CSS and Babel) 👌 The Simplest Usage 👌
{
"name": "webpack-sass",
"version": "1.0.0",
"scripts": {
"start": "webpack-dev-server --open --mode development",
"build": "webpack -p"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.4",
@ufuk
ufuk / JpaEntityQueryBuilder.java
Last active January 8, 2023 17:38
Easy to use query builder for JPA Criteria API
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.IteratorUtils;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.query.criteria.internal.path.PluralAttributePath;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.repository.support.PageableExecutionUtils;
import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;
@ricsiga
ricsiga / kurento-media-server.service
Created August 18, 2016 15:19
Kurento media server systemd unit file example
[Unit]
Description=Kurento Media Server daemon
After=network.target
[Service]
ExecStart=/usr/bin/kurento-media-server
Type=simple
PIDFile=/var/run/kurento-media-server.pid
Restart=always
@denji
denji / nginx-tuning.md
Last active May 17, 2024 04:16
NGINX tuning for best performance

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.