Skip to content

Instantly share code, notes, and snippets.

View dgierejkiewicz's full-sized avatar

Dariusz Gierejkiewicz dgierejkiewicz

View GitHub Profile
@dgierejkiewicz
dgierejkiewicz / install-docker.sh
Created October 29, 2018 14:57 — forked from dweldon/install-docker.sh
Install docker CE on Linux Mint 18.3
#!/usr/bin/env bash
# https://docs.docker.com/install/linux/docker-ce/ubuntu/
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable"
sudo apt-get update
sudo apt-get install docker-ce
# https://docs.docker.com/compose/install/
@dgierejkiewicz
dgierejkiewicz / upgrade-postgres-9.5-to-9.6.md
Created October 30, 2018 08:51 — forked from delameko/upgrade-postgres-9.5-to-9.6.md
Upgrading PostgreSQL from 9.5 to 9.6 on Ubuntu 16.04

TL;DR

Install Postgres 9.6, and then:

sudo pg_dropcluster 9.6 main --stop
sudo pg_upgradecluster 9.5 main
sudo pg_dropcluster 9.5 main
@dgierejkiewicz
dgierejkiewicz / web-servers.md
Created April 16, 2019 13:25 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@dgierejkiewicz
dgierejkiewicz / LoggerTrait.php
Created June 11, 2019 06:40 — forked from fosron/LoggerTrait.php
Trait for Logging to both Console and A Log File (To use with Laravel Artisan Commands)
<?php
namespace App\Traits;
use Monolog\Formatter\FormatterInterface;
use Monolog\Formatter\JsonFormatter;
use Monolog\Formatter\LineFormatter;
use Monolog\Handler\RotatingFileHandler;
use Monolog\Logger;
use Monolog\Processor\GitProcessor;
@dgierejkiewicz
dgierejkiewicz / .gitignore Java
Created December 10, 2019 13:13 — forked from dedunumax/.gitignore Java
A complete .gitignore file for Java
##############################
## Java
##############################
.mtj.tmp/
*.class
*.jar
*.war
*.ear
*.nar
hs_err_pid*
@dgierejkiewicz
dgierejkiewicz / consumer.sh
Created December 11, 2019 15:43 — 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
@dgierejkiewicz
dgierejkiewicz / nginx-tuning.md
Created December 21, 2019 16:25 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

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.

# source: https://github.com/kiasaki/docker-alpine-postgres
FROM alpine
RUN echo "@edge http://nl.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories && \
apk update && \
apk add curl "libpq@edge<9.7" "postgresql-client@edge<9.7" "postgresql@edge<9.7" "postgresql-contrib@edge<9.7" && \
curl -o /usr/local/bin/gosu -sSL "https://github.com/tianon/gosu/releases/download/1.2/gosu-amd64" && \
chmod +x /usr/local/bin/gosu && \
apk del curl && \
rm -rf /var/cache/apk/*
@dgierejkiewicz
dgierejkiewicz / cache.go
Created January 19, 2020 06:03 — forked from harlow/cache.go
Golang cache map
package cache
import (
"crypto/sha256"
"encoding/json"
"fmt"
"os"
"sync"
"time"
)
@dgierejkiewicz
dgierejkiewicz / concurrency-in-go.md
Created January 21, 2020 10:05 — forked from kachayev/concurrency-in-go.md
Channels Are Not Enough or Why Pipelining Is Not That Easy