Skip to content

Instantly share code, notes, and snippets.

inp
|> String.split("\n", trim: true)
|> Enum.map(&String.split(&1, "\t"))
|> Enum.map(fn a -> a |> Enum.map(&String.to_integer/1) end)
|> Enum.map(fn a -> [Enum.max(a), Enum.min(a)] end)
|> Enum.map(fn [a, b] -> a - b end)
|> Enum.sum()
|> IO.inspect()
defmodule Helper do
@zgohr
zgohr / pyrasite.md
Created April 12, 2018 02:00
stack trace for all threads of a running python process
sudo apt-get install gdb
pip install pyrasite
pyrasite-shell {pid}
import sys, traceback
for tid, frame in sys._current_frames().items():
 print("Stack for thread {}".format(tid))
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.