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=","
@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
@v0lkan
v0lkan / nginx.conf
Last active July 12, 2024 08:28
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

Ubuntu IP Tables (Firewall)

When setting up an Ubuntu server, you'll want to establish basic security including a firewall to only allow certain types of requests, and to allow only certain types of responses. This code will:

  • Flush your current firewall
  • Because it's our server and we're not hosting other people's stuff (like a shared server), we'll allow all output
  • Allow input requests for SSH, Port 80 and 443 (Web and TLS (SSL))
  • Log bad requests with the prefix "iptables denied:"
  • Then save these rules to a file called /etc/iptables.up.rules
@natelandau
natelandau / .bash_profile
Last active June 13, 2024 18:01
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management