Skip to content

Instantly share code, notes, and snippets.

@aileftech
aileftech / hex-colors.txt
Created October 1, 2022 18:10
A Bash one-liner to produce a list of HEX color codes that read like (supposedly) valid English words
$ grep -P "^[ABCDEFabcdefOoIi]{6,6}$" /usr/share/dict/words | tr 'OoIi' '0011' | tr '[:lower:]' '[:upper:]' | awk '{print "#" $0}'
#ACAD1A
#B0BB1E
#DEBB1E
#AB1DED
#ACAC1A
#ACCEDE
#AC1D1C
#BAB1ED
#BA0BAB
@mculp
mculp / psqlrc
Last active September 4, 2023 04:46
psqlrc with aliases for index, slow queries, locks, etc
--
-- save this as ~/.psqlrc
--
-- run an alias with :
--
-- e.g. :long_running_queries
\set QUIET 1
-- formatting
@kocercan
kocercan / nginx-alertmanager-prometheus-grafana
Last active May 9, 2023 18:51 — forked from flaviocarmo/nginx-alertmanager-prometheus
Nginx reverse proxy for Prometheus, Alertmanager, Grafana one domain with subdirectories
# add to /lib/systemd/system/prometheus.service
# --web.external-url=https://monitoring.mydomain.com/prometheus/
# add to /lib/systemd/system/alertmanager.service
# --web.external-url=https://monitoring.mydomain.com/alertmanager \
# --web.route-prefix="/" \
# --cluster.advertise-address=0.0.0.0:9093
# systemctl daemon-reload
# systemctl restart prometheus alertmanager
#
cat <<EOF > /etc/nginx/conf.g/monitoring.conf
@Totktonada
Totktonada / README.md
Created February 10, 2021 05:26
tarantool/http v1 vs v2 benchmarking

How to run

Prepare tarantool and modules builds:

git clone https://github.com/tarantool/http.git http-v1
cd http-v1
git checkout da1407c8e82dbdfd44abab8b1bb9860c217e7e22
cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo && make -j
cd -
@tano297
tano297 / sshfs.sh
Last active June 12, 2023 11:26
Mount and unmount remotes with sshfs
# remote mount functions
remote-mount()
{
# Mount a remote ssh root directory in /media/$USER/remotes/[remote alias]
# This function requires 1 argument, which is the ssh alias you made for the
# remote in your .ssh/config.
# If the directory is not created, it will try to, but this part is probably only
# going to be called the first time for each remote, unless you change the alias.
# To unmount, see remote-unmount().

Это краткая памятка, которая подходит во время вспышки любого респираторного вирусного заболевания. Я ее пишу не для того, чтобы вы срочно начинали все это делать - никакого повода нет. Но, если вы хотите снизить вероятность получения или распространения вирусов - прочитайте.

Общее поведение

  1. Контролируйте свою панику. Никакого повода для паники нет, как говорил человек, падающий с пятого этажа, пролетая мимо четвертого: “пока все нормально”. Напомню, уже на вашей памяти у людей была такая же паника из-за птичьего гриппа и атипичной пневмонии. И никакого зомби-апокалипсиса не произошло. Контролировать панику - значит следить за своими реакциями и стараться принимать решения разумно.
  2. Не осуждайте чужую панику. Это не помогает ни вам, ни паникующим - каждый человек волен паниковать или не паниковать перед лицом любой опасности. Кроме того, активное осуждение паники вокруг “эпидемий” порождает и подпитывает многочисленные теории заговора, так что просто не надо.
  3. Примите разумные меры предосторожно
@nottrobin
nottrobin / nginx-sigquit.Dockerfile
Created November 15, 2019 11:48
nginx should use STOPSIGNAL SIGQUIT
FROM nginx
RUN echo 'server {\n\
listen 80 default_server;\n\
location / {\n\
proxy_pass http://httpbin.org/delay/10;\n\
}\n\
}' > /etc/nginx/conf.d/default.conf
STOPSIGNAL SIGQUIT
@denji
denji / http_modules_ngx__http__slice_read_ahead.patch
Created November 4, 2019 07:21
http_modules_ngx__http__slice_read_ahead.c The existing slice module (https://nginx.org/en/docs/http/ngx_http_slice_module.html) only starts fetching a given slice whenever bytes in that range for that slice is requested. The patch allows you to configure a variable (slice_read_ahead X) which will cause nginx to start proactively reading X futur…
Index: Makefile
===================================================================
--- Makefile (revision 507358)
+++ Makefile (revision 507359)
@@ -74,7 +74,7 @@
HTTP_CACHE HTTP_DAV HTTP_FLV HTTP_GUNZIP_FILTER HTTP_GZIP_STATIC \
HTTP_IMAGE_FILTER HTTP_MP4 HTTP_PERL HTTP_RANDOM_INDEX HTTP_REALIP \
HTTP_REWRITE HTTP_SECURE_LINK HTTP_SLICE HTTP_SSL HTTP_STATUS HTTP_SUB \
- HTTP_XSLT HTTPV2 STREAM STREAM_SSL STREAM_SSL_PREREAD
+ HTTP_XSLT HTTPV2 STREAM STREAM_SSL STREAM_SSL_PREREAD HTTP_SLICE_AHEAD
@elasticdog
elasticdog / vault-cp
Created July 27, 2018 18:32
A script to copy Vault secrets from one path to another
#!/usr/bin/env bash
# ensure we were given two command line arguments
if [[ $# -ne 2 ]]; then
echo 'usage: vault-cp SOURCE DEST' >&2
exit 1
fi
source=$1
dest=$2
@bykvaadm
bykvaadm / sentry.py
Created June 4, 2018 08:58 — forked from fliphess/sentry.py
Ansible sentry callback plugin - Send all errors from ansible to Sentry
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import getpass
import logging
import logging.config
import os
import socket
try: