This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(mylists). | |
-export([ unflatten/2 ]). | |
unflatten([],[]) -> | |
[]; | |
unflatten(List,[PSubList|PList]) -> | |
unflatten(List,[],[],PSubList,PList). | |
unflatten([],SubList,Lists,[],[]) -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM busybox | |
MAINTAINER Joel Meyer <[email protected]> | |
ADD ./kubegateway /kubegateway | |
ADD ./kubegateway.go /kubegateway.go | |
ENTRYPOINT ["/kubegateway"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Struct do | |
defp filter_nil({_,nil}), do: false | |
defp filter_nil(_), do: true | |
def destruct(%{:__struct__ => _} = v), do: Map.from_struct(v) |> destruct | |
def destruct(v) when is_list(v), do: Enum.map(v, &destruct/1) | |
def destruct(v) when is_map(v), do: Enum.filter_map(v, &filter_nil/1, &destruct/1) |> Enum.into %{} | |
def destruct({k,v}), do: {k,destruct(v)} | |
def destruct(v), do: v | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/app/plugs/cache_control.ex | |
defmodule App.Plugs.CacheControll do | |
import Plug.Conn | |
def init({val, :seconds}), do: val | |
def init({val, :minutes}), do: 60*val | |
def init({val, :hours }), do: 60*60*val | |
def init({val, :days }), do: 24*60*60*val | |
def init({val, :weeks }), do: 7*24*60*60*val | |
def init({val, :months }), do: 30*7*24*60*60*val |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[joel.meyer@LUMI:src/poison]$ MIX_ENV=bench elixir -pa _build/bench/lib/\*/ebin -pa _build/bench/consolidated -S mix bench (02-11 11:38) | |
bench/encoder_bench.exs:131: warning: the Poison.Encoder protocol has already been consolidated, an implementation for EncoderBench.Struct has no effect | |
bench/encoder_bench.exs:131: warning: the Poison.Encoder protocol has already been consolidated, an implementation for EncoderBench.Struct has no effect | |
Settings: | |
duration: 1.0 s | |
## EncoderBench | |
[11:38:31] 1/33: structs (Poison) | |
[11:38:33] 2/33: structs (Jazz) | |
[11:38:35] 3/33: structs (JSX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/sh | |
# Usage: ./get_all_gcp_cluster_creds.sh PROJECT1 [PROJECT2 ...] | |
for project in "$@" | |
do | |
echo "Getting cluster credentials for project $project" | |
gcloud container clusters list --project $project --format="table[no-heading](name,location)" | while read cluster location | |
do | |
gcloud container clusters get-credentials $cluster --project $project --region $location |