This file contains hidden or 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 MyApp.Prompts.Audit do | |
| @moduledoc """ | |
| Prompts for the audit pipeline. Two entry points: | |
| * `audit_file/4` — embeds a single source file in the prompt and | |
| runs `MyApp.CodingAgent` against it. Style is `:simple` or | |
| `:deep`; the executor picks based on `audit.strategy`. | |
| * `audit_directory/2` — whole-package audit. Spawns the agent with | |
| `:cwd` set to the source dir so it can use Read/Grep/Bash. | |
| """ |
This file contains hidden or 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
| Originally from: http://erlang.org/pipermail/erlang-questions/2017-August/093170.html | |
| For a safe and fast Erlang SSL server, there's a few | |
| configuration values you might want by default: | |
| [{ciphers, CipherList}, % see below | |
| {honor_cipher_order, true}, % pick the server-defined order of ciphers | |
| {secure_renegotiate, true}, % prevent renegotiation hijacks | |
| {client_renegotiation, false}, % prevent clients DoSing w/ renegs | |
| {versions, ['tlsv1.2', 'tlsv1.1']}, % add tlsv1 if you must |
This file contains hidden or 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
| # You will need fswatch installed (available in homebrew and friends) | |
| # The command below will run tests and wait until fswatch writes something. | |
| # The --stale flag will only run stale entries, it requires Elixir v1.3. | |
| fswatch lib/ test/ | mix test --stale --listen-on-stdin |
This file contains hidden or 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 ReleaseManager.Plugin.ReleaseTasks do | |
| @name "release_tasks" | |
| @shortdoc "Generates an escript to invoke PS.ReleaseTasks" | |
| use ReleaseManager.Plugin | |
| alias ReleaseManager.Utils | |
| def before_release(_), do: nil | |
| def after_release(%Config{name: name}) do |
This file contains hidden or 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 Lookup do | |
| @wordfile "words.txt" | |
| @external_resource @wordfile | |
| @times 1_000_000 | |
| @words @wordfile |> File.stream! |> Enum.map(&String.strip/1) | |
| @hash_set Enum.into(@words, HashSet.new) | |
| @map_set Enum.into(@words, MapSet.new) |
This file contains hidden or 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
| language: elixir | |
| elixir: | |
| - 1.0.5 | |
| otp_release: 17.3 | |
| matrix: | |
| include: | |
| - elixir: 1.2 |
This gist is deprecated in favor of https://github.com/ninenines/cowboy/blob/master/doc/src/guide/specs.asciidoc which has a formatted version at https://ninenines.eu/docs/en/cowboy/2.0/guide/specs/
This file contains hidden or 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
| iex> """ |> Erlang.module_to_core |> IO.puts | |
| ...> -file("nofile", 1). | |
| ...> -module('Elixir.M'). | |
| ...> | |
| ...> -export([hello/0]). | |
| ...> | |
| ...> hello() -> hello. | |
| ...> """ | |
| module 'Elixir.M' ['hello'/0, | |
| 'module_info'/0, |
This file contains hidden or 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
| defp escape({ left, meta, right }) do | |
| { '{}', meta, [escape(left), meta, escape(right)] } | |
| end | |
| defp escape({ left, right }) do | |
| { escape(left), escape(right) } | |
| end | |
| defp escape(list) when is_list(list) do | |
| Enum.map(list, escape(&1)) |
NewerOlder