Skip to content

Instantly share code, notes, and snippets.

@haproxytechblog
haproxytechblog / blog20220203-01.sh
Created February 3, 2022 21:37
Load Balance an Infinite Number of Servers And Never Reload HAProxy
$ echo "experimental-mode on; add server be_app/server10 10.0.1.5:80 check" |\
socat stdio tcp4-connect:127.0.0.1:9999
@superseb
superseb / etcd-restore.sh
Last active April 20, 2023 07:31
Single command etcd snapshot restore to inspect etcd contents
#!/usr/bin/env bash
if [ $# -ne 2 ]; then
echo "Usage: $0 [filename] [etcd_version]"
exit 1
fi
FILENAME=$1
ETCD_VERSION=$2
TIMESTAMP="$(date +%s)"
" Specify a directory for plugins
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-sensible'
Plug 'pangloss/vim-javascript'
Plug 'mxw/vim-jsx'
call plug#end()
set nu
set encoding=utf-8
let mapleader=","
@elundmark
elundmark / rain.sh
Created July 27, 2019 12:18
Rainbows!
#!/usr/bin/env bash
set -e
repeat_char () {
printf '%0*d' "$2" 0 | sed 's/0/'"$1"'/g'
return 0
}
if ! command -v lolcat; then
@haproxytechblog
haproxytechblog / blog20190207-01.sh
Last active August 9, 2023 22:05
Introduction to HAProxy Logging
sudo apt install -y rsyslog
@virgilwashere
virgilwashere / _Mautic_nginx_config_files.md
Last active February 17, 2024 02:28 — forked from magnetikonline/README.md
Mautic nginx config files
@bradwestfall
bradwestfall / S3-Static-Sites.md
Last active May 22, 2024 13:44
Use S3 and CloudFront to host Static Single Page Apps (SPAs) with HTTPs and www-redirects. Also covers deployments.

S3 Static Sites

⚠ This post is fairly old. I don't keep it up to date. Be sure to see comments where some people have posted updates

What this will cover

  • Host a static website at S3
  • Redirect www.website.com to website.com
  • Website can be an SPA (requiring all requests to return index.html)
  • Free AWS SSL certs
  • Deployment with CDN invalidation
@elundmark
elundmark / vsleep
Last active August 12, 2022 05:25
Verbose Sleep - echo the progress to stderr
#!/usr/bin/env bash
get_ms () {
date +'%s%N' | grep -oP '^[0-9]{13}'
}
show_usage () {
# *******************************************************************
read -d '' help_text <<- EOF
vsleep - verbose sleep
@v0lkan
v0lkan / nginx.conf
Last active May 16, 2024 08:32
Configuring NGINX for Maximum Throughput Under High Concurrency
user web;
# One worker process per CPU core.
worker_processes 8;
# Also set
# /etc/security/limits.conf
# web soft nofile 65535
# web hard nofile 65535
# /etc/default/nginx
@PiBa-NL
PiBa-NL / haproxy, remove 'app' after selecting backend
Last active June 22, 2022 02:25
haproxy, remove /app after selecting backend
Code to change a request from / to /app1/
reqirep ^([^\ :]*)\ /(.*) \1\ /app1/\2
If urls in the response contain absolute urls it might be required to use this:
acl no_redir url_beg /app1/
reqirep ^([^\ :]*)\ /(.*) \1\ /app1/\2 if !no_redir
The code makes sure that the method and url-path behind the / stays the same. Which method you need exactly might depend on the application thats running.
For readability of the above how change a request from /app1/ to /app1/app1redir/
reqirep ^([^\ :]*)\ /app1/(.*) \1\ /app1/app1redir/\2