See Configuring NGINX to accept the PROXY Protocol - NGINX
upstream wsserver {
server 127.0.0.1:9000;
}
See Configuring NGINX to accept the PROXY Protocol - NGINX
upstream wsserver {
server 127.0.0.1:9000;
}
(ns x.y | |
(:use [plumbing.core]) ;; Just for the map-vals | |
(:require [clojure.walk :refer [postwalk prewalk prewalk-demo postwalk-demo]] | |
[clojure.core.match :refer [match]] | |
[schema.utils :refer [named-error-explain validation-error-explain]] | |
[schema.core :as s]) | |
(:import (schema.utils NamedError ValidationError))) | |
;; Partially FROM: | |
;; https://github.com/puppetlabs/clj-schema-tools |
defmodule CidrCalc do | |
def addresses_for(ip) do | |
{:ok, range_start, range_end}= String.to_char_list(ip) |> :orber_acl.range(:inet) | |
[net_a, net_b, net_c, net_d] = Enum.zip(convert(range_start), convert(range_end)) | |
|> Enum.map(fn {s, e} -> s..e end) | |
for a <- net_a, b <- net_b, c <- net_c, d <- net_d, do: {a, b, c, d} | |
end |
defmodule Knox.Ecto.Hstore do | |
@behaviour Ecto.Type | |
def type, do: :hstore | |
def blank?, do: false | |
def load(t), do: { :ok, t } | |
def dump(t), do: { :ok, t } | |
def cast(t), do: { :ok, t } | |
end |
defmodule Chain do | |
defmacro chain(ex) do | |
parse(ex) | |
end | |
defp parse({:., _, [first_arg, function_name]}, more_args) do | |
args = [first_arg|more_args] |> Enum.map(&parse/1) | |
apply(String, function_name, args) | |
end |
@doc """ | |
Convert a floki tree to html again | |
""" | |
def tag_parser(list) do | |
{tag, options, children} = list | |
formatted_options = options |> Enum.map(fn option -> | |
{key, value} = option | |
"#{key}='#{value}'" | |
end) |> Enum.join(" ") |
package main | |
import ( | |
"crypto/rand" | |
"fmt" | |
"log" | |
"math/big" | |
"time" | |
) |
require 'singleton' | |
class Maybe | |
def self.unit(value) | |
if value.nil? || (value.respond_to?(:empty?) && value.empty?) | |
Nothing.instance | |
else | |
Just.new(value) | |
end | |
end |
Based on tests on my machine (2013 MacBook Pro, 2.6 GHz i7, 16 GB RAM) generated by https://github.com/pragdave/map_performance
Elixir v1.0.4