Skip to content

Instantly share code, notes, and snippets.

@joshuar
joshuar / iptables-connection-sharing.sh
Last active December 27, 2020 16:04
Quick script to enable connection sharing (i.e. nat) on an interface in Linux. Based on http://xmodulo.com/2014/06/internet-connection-sharing-iptables-linux.html
#!/bin/bash
while getopts "i:t:" opt; do
case $opt in
i)
$(ip link show $OPTARG 1> /dev/null 2>&1)
if [[ $? != 0 ]]; then
echo "Argument to -${opt} should be an network device."
exit -1
else
@joshuar
joshuar / nginx.conf
Created October 30, 2015 03:53
Logging Elasticsearch HTTP API Requests with Nginx
worker_processes 1;
error_log /var/log/nginx/error.log;
events {
worker_connections 1024;
}
http {
log_format es '$remote_addr - $remote_user [$time_local] '