Skip to content

Instantly share code, notes, and snippets.

@joshnuss
joshnuss / udp_server.exs
Last active October 9, 2023 09:11
Fault tolerant UDP Server in Elixir
# 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 March 12, 2014 19:17
A way to whitelist certain IP ranges from limit_req_zone in nginx
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;
}