Skip to content

Instantly share code, notes, and snippets.

View kmjones1979's full-sized avatar
🌴
Vibe Coding

Kevin J kmjones1979

🌴
Vibe Coding
View GitHub Profile
@kmjones1979
kmjones1979 / nginx_syntax_vim.sh
Last active November 17, 2016 00:09
Enable syntax highlighting within vim for NGINX configuration files
#!/bin/bash
wget -O nginx.vim http://www.vim.org/scripts/download_script.php\?src_id\=19394
mkdir -p ~/.vim/syntax
mv nginx.vim ~/.vim/syntax/
echo "au BufRead,BufNewFile /etc/nginx/*,/usr/local/nginx/conf/* if &ft == '' | setfiletype nginx | endif" | tee -a ~/.vim/filetype.vim
@kmjones1979
kmjones1979 / nginx.conf
Created August 3, 2016 16:50
Dynamic Cache based on header
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
@kmjones1979
kmjones1979 / nginx.conf
Last active December 27, 2024 22:33
This is an example NGINX configuration for the blog: Performing A/B Testing with NGINX - This demonstrates split_clients based routing on an argument named token
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
events { worker_connections 1024; }
http {
default_type text/html;
log_format main '$remote_addr -> $request $status $body_bytes_sent bytes -> $upstream_addr';
access_log /var/log/nginx/access.log main;
@kmjones1979
kmjones1979 / nginx.conf
Last active November 28, 2017 22:48
This is an example NGINX configuration for the blog: Performing A/B Testing with NGINX - This example demonstrates the sticky route functionality
events { worker_connections 2014; }
http {
default_type text/plain;
log_format cookie '$cookie_route - $route_cookie, '
'$request_uri - $route_uri, '
'$route - $upstream_addr';
error_log /var/log/nginx/debug_error.log debug;
@kmjones1979
kmjones1979 / mapquest_api.py
Created June 8, 2016 05:55
Python script to parse a CSV for a ZIP code and then query Mapquest's API for details between source and destination
import requests
import csv
# zip code api variables
API_URL = 'http://www.mapquestapi.com/directions/v2/route'
KEY = 'SECRET'
DEST = 'ZIP_CODE_HERE'
# csv variables
FILE = '/path/to/geo_zip.csv'
@kmjones1979
kmjones1979 / nginx.conf
Last active June 6, 2016 16:57
map argument to new variable with NGINX
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
@kmjones1979
kmjones1979 / nginx.conf
Created June 2, 2016 21:12
NGINX configuration used for MaxCDN meetup demonstration in Los Angeles 2016
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
@kmjones1979
kmjones1979 / nginx.conf
Last active July 9, 2024 10:53
Example NGINX configuration to route based on country code using GeoIP
# load dynamic modules
load_module /etc/nginx/modules/ngx_http_geoip_module.so;
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
events { worker_connections 1024; }
http {
@kmjones1979
kmjones1979 / nginx.conf
Last active January 18, 2024 17:25
Example NGINX configuration using auth_request and auth_request_set directives to route users
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
events { worker_connections 1024; }
http {
default_type text/html;
log_format main '$remote_addr -> $request $status $body_bytes_sent bytes -> $upstream_addr';
access_log /var/log/nginx/access.log main;
@kmjones1979
kmjones1979 / nginx.conf
Last active November 16, 2017 12:04
Example NGINX configuration to perform A/B deployments
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
events { worker_connections 1024; }
http {
default_type text/html;
log_format main '$remote_addr -> $request $status $body_bytes_sent bytes -> $upstream_addr';
access_log /var/log/nginx/access.log main;