Skip to content

Instantly share code, notes, and snippets.

@joshnuss
joshnuss / udp_server.exs
Last active Apr 26, 2021
Fault tolerant UDP Server in Elixir
View udp_server.exs
# to run:
# > elixir --no-halt udp_server.exs
# to test:
# > echo "hello world" | nc -u -w0 localhost:2052
# > echo "quit" | nc -u -w0 localhost:2052
# Let's call our module "UDPServer"
defmodule UDPServer do
# Our module is going to use the DSL (Domain Specific Language) for Gen(eric) Servers
use GenServer
@skaag
skaag / limt_req_zone_whitelist
Created Mar 12, 2014
A way to whitelist certain IP ranges from limit_req_zone in nginx
View limt_req_zone_whitelist
geo $limited {
default 1;
# Wordpress Jetpack ranges:
192.0.0.0/16 0;
66.135.0.0/16 0;
66.155.0.0/16 0;
76.74.0.0/16 0;
}