Skip to content

Instantly share code, notes, and snippets.

@hodak
Created September 1, 2018 15:13
Show Gist options
  • Save hodak/418b15613b1a66eb546fb4882b132b1b to your computer and use it in GitHub Desktop.
Save hodak/418b15613b1a66eb546fb4882b132b1b to your computer and use it in GitHub Desktop.
Courtesy of @teamon. Put these files in /usr/local/bin
#!/usr/bin/env elixir
defmodule Decompile do
def main([beam_file]) do
{:ok,{_,[{:abstract_code,{_,ac}}]}} = :beam_lib.chunks(to_charlist(beam_file),[:abstract_code])
:io.fwrite("~s~n", [:erl_prettypr.format(:erl_syntax.form_list(ac))])
end
end
Decompile.main(System.argv)
#!/bin/bash
# decompile.exs $@ | highlight --syntax erlang --out-format ansi
decompile.exs $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment