Skip to content

Instantly share code, notes, and snippets.

@ziplex
ziplex / bash.sh
Created December 4, 2020 16:01 — forked from cristian-sr/bash.sh
Bash-scripting
https://devhints.io/bash
Example
#!/usr/bin/env bash
NAME="John"
echo "Hello $NAME!"
Variables
NAME="John"
@ziplex
ziplex / gist:8081b1c83e8c093738be33de581c96f2
Created November 27, 2020 12:09 — forked from jessedearing/gist:2351836
Create self-signed SSL certificate for Nginx
#!/bin/bash
echo "Generating an SSL private key to sign your certificate..."
openssl genrsa -des3 -out myssl.key 1024
echo "Generating a Certificate Signing Request..."
openssl req -new -key myssl.key -out myssl.csr
echo "Removing passphrase from key (for nginx)..."
cp myssl.key myssl.key.org
openssl rsa -in myssl.key.org -out myssl.key
@ziplex
ziplex / http-benchmark.md
Created October 8, 2020 16:45 — forked from denji/http-benchmark.md
HTTP(S) Benchmark Tools / Toolkit for testing/debugging HTTP(S) and restAPI (RESTful)
@ziplex
ziplex / ansible.md
Created October 6, 2020 05:53 — forked from douglasmiranda/ansible.md
Ansible: Notes, Errors and Solutions

Ansible for Configuration Management

I'm using Ansible only for Configuration Management, the server is up and I want to configure users, install packages and configure them.

For infrastructure provisioning terraform.io is nice!

Currently, my deployment flow includes Drone.io/GitlabCI for CI/CD and Docker Swarm for orchestrating containers.

@ziplex
ziplex / fix-ubuntu-with-kernal-boot-options.sh
Created August 28, 2020 18:49 — forked from donrestarone/fix-ubuntu-with-kernal-boot-options.sh
fixing ubuntu system lockups with Ryzen CPU's
# open the boot parameters file for the linux kernal
sudo nano /etc/default/grub
# we will be editing the 'GRUB_CMDLINE_LINUX_DEFAULT' key
#set it to
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash processor.max_cstate=1 rcu_nocbs=0-11"
# test for a while and then set it to 5 if all is well
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash processor.max_cstate=5 rcu_nocbs=0-11"

Assuming you are using the official PHP Docker image...

# ---------------------------------------------------------------
# PHP Extension: Gearman
# Download Gearman PECL extension for Gearman supporting PHP 7
RUN apt-get -y --allow-unauthenticated install \
    libgearman-dev
RUN cd /tmp \
 && git clone https://github.com/wcgallego/pecl-gearman.git \

создаем таблицу

❯ curl -d "" "http://127.0.0.1:8123/?query=CREATE+TABLE+test+(x+UInt32,+y+String,+z+String)+ENGINE+=+TinyLog;"

смотрим формат входящих данных для VALUES

❯ cat example.values
(1, 'foo', 'bar'),
(2, 'foo', 'baz'),

(3, 'fxx', 'bxx')

@ziplex
ziplex / blackbox-consul
Created July 24, 2020 13:19 — forked from ycyr/blackbox-consul
prometheus-consul
- job_name: 'blackbox'
metrics_path: /probe
consul_sd_configs:
- server: '192.168.0.30:8500'
relabel_configs:
- source_labels: [__meta_consul_tags]
regex: .*,blackbox,.*
action: keep
- source_labels: [__meta_consul_service]
target_label: job
@ziplex
ziplex / grafana-telegram-bot.md
Created July 21, 2020 15:45 — forked from kkirsanov/grafana-telegram-bot.md
Как подключить telegram-бота к графане
  1. Cоздаем своего бота: Ищем в телеграмме бота @BotFather и говорим /newbot. В процессе создания получаем api-key для бота
  2. Добавляем в интересующий нас чат этого бота
  3. В этот же чат добавляем бота @myidbot и говорим ему /getgroupid@myidbot. Эта команда даст нам id чата
  4. В настройках Notification Channel графаны выбираем telegram и пишем туда полученные ранее api-key и id чата

Certbot и nginx, как обратный прокси в Docker (пример с 2 react проектами)

В результате будет 2 react проекта на 1 сервере доступных по разным ссылкам

Цели

  • Запустить nginx в одном контейнере
  • Запустить другие проекты в других контейнерах
  • Научить nginx перенаправлять запросы с разных доменов на разные проекты
  • Получить ssl сертификаты для всех проектов