Skip to content

Instantly share code, notes, and snippets.

@kirosvi
kirosvi / nginx-tuning.md
Created June 16, 2021 16:21 — 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.

@kirosvi
kirosvi / benchmark-commands.md
Created May 6, 2021 10:41 — forked from ueokande/benchmark-commands.md
Kafka Benchmark Commands

Benchmark commands

Producer

Setup

bin/kafka-topics.sh \
  --zookeeper zookeeper.example.com:2181 \
  --create \
@kirosvi
kirosvi / consumer.sh
Created May 6, 2021 10:41 — forked from dongjinleekr/consumer.sh
Kafka benchmark commands
## Consumer Throughput: Single consumer thread, no compression
## Consumer Throughput: 3 consumer thread, no compression
bin/kafka-consumer-perf-test.sh --topic benchmark-3-3-none \
--zookeeper kafka-zk-1:2181,kafka-zk-2:2181,kafka-zk-3:2181 \
--messages 15000000 \
--threads 1
@kirosvi
kirosvi / monzo-alertmanager-config.yaml
Created January 12, 2021 15:55 — forked from milesbxf/monzo-alertmanager-config.yaml
Monzo's Alertmanager Slack templates
###################################################
##
## Alertmanager YAML configuration for routing.
##
## Will route alerts with a code_owner label to the slack-code-owners receiver
## configured above, but will continue processing them to send to both a
## central Slack channel (slack-monitoring) and PagerDuty receivers
## (pd-warning and pd-critical)
##
@kirosvi
kirosvi / server_certificates_to_pem.md
Created August 7, 2019 13:39 — forked from stevenhaddox/server_certificates_to_pem.md
Convert .crt & .key files into .pem file for HTTParty

Two ways to do it, but only worked for me so I'll put it first and the second for reference:

$ openssl pkcs12 -export -in hostname.crt -inkey hsotname.key -out hostname.p12
$ openssl pkcs12 -in hostname.p12 -nodes -out hostname.pem

Other options for this method in comments below:

# Note, the -certfile root.crt appends all CA certs to the export, I've never needed these so it's optional for my personal steps
$ openssl pkcs12 -export -in hostname.crt -inkey hsotname.key -certfile root.crt -out hostname.p12

Note, I've always had my hostname.crt as part of my .pem, so I keep my certs but apparently you may not have to, hence the nocerts flag being an extra option in this sample

@kirosvi
kirosvi / parse_yaml.sh
Created July 17, 2019 08:38 — forked from pkuczynski/LICENSE
Read YAML file from Bash script
#!/bin/sh
parse_yaml() {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}
@kirosvi
kirosvi / mtomb
Created February 20, 2016 17:18 — forked from mitshel/mtomb
mediatomb console script for add or remove media-catalogs
#!/bin/bash
# Commands for MYSQL with mediatomb database
# create user 'mt'@'%' identified by 'mt';
# grant select on mediatomb.* to 'mt'@'%';
cmd=$1
catalog=$2
meditomb_ip=192.168.7.10
mtombdb="mysql -h $mediatomb_ip mediatomb -umt -pmt"
@kirosvi
kirosvi / flac2ogg_in_folder.py
Last active August 29, 2015 14:14
simple converting files in directory, that you can call from everywhere in directory with files
#!/usr/bin/python
import os, subprocess
os.chdir(os.getcwd())
sourcedir = "./"
convert_list = []
f_ext = ".flac" #extension of source file
f_extnew = ".ogg" #extension of output file
ffmpeg = "/usr/local/bin/ffmpeg" # path to ffmpeg
params = "-strict experimental -acodec vorbis -aq 100" # settings of converting which in command after source file and before output file