Skip to content

Instantly share code, notes, and snippets.

View novaugust's full-sized avatar

Matt Enlow novaugust

View GitHub Profile
@novaugust
novaugust / insta_2_json.exs
Last active December 21, 2022 16:05
instagram to ghost scripts
Mix.install [:floki, :jason]
defmodule InstaDumpParser do
def parse_url(url) do
# ghost uploads to this, keeping filename:
# https://blog.novaugust.net/content/images/2022/12/10616813_1695162544038552_1763391856_n_17841611368072760.jpg
[year, month, filename] = Regex.run(~r|media/posts/(\d\d\d\d)(\d\d)/(.*)|, url, capture: :all_but_first)
%{year: year, month: month, filename: filename}
end
@novaugust
novaugust / 1_rewriting_a_codebase_with_sourceror.exs
Last active March 1, 2023 21:35
Credo Rewrites Via Sourceror
# for an example of a suggested `locals_without_parens`, see z_locals_without_parens.exs
# parsing and expanding a formatter.exs file would be a good route too
opts = [sourceror_opts: [locals_without_parens: [...], line_length: 122]]
for transformation <- [&PipeChainStart.run/1, &SinglePipe.run/1] do
ProjTraversal.transform("../my_codebase/", transformation, opts)
end