Skip to content

Instantly share code, notes, and snippets.

View ericmj's full-sized avatar

Eric Meadows-Jönsson ericmj

View GitHub Profile
@PJUllrich
PJUllrich / audit.ex
Created May 12, 2026 10:58
The Prompts I use for finding Vulnerabilities in Elixir/Erlang projects
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.
"""
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
@josevalim
josevalim / watcher.sh
Last active May 22, 2024 10:06
A 1LOC bash script for re-running tests whenever a lib/ or test/ file changes keeping the same VM instance
# 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
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
@koudelka
koudelka / lookup.ex
Created October 2, 2015 21:13
Elixir Set Lookup
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)
@BanzaiMan
BanzaiMan / .travis.yml
Created September 25, 2015 15:44
Matrix trick for Elixir 1.2 & 1.x
language: elixir
elixir:
- 1.0.5
otp_release: 17.3
matrix:
include:
- elixir: 1.2
@essen
essen / http_specs.md
Last active January 10, 2022 02:01
HTTP and related specifications
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,
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))