Skip to content

Instantly share code, notes, and snippets.

View the-mikedavis's full-sized avatar

Michael Davis the-mikedavis

View GitHub Profile
-module(jaro).
-export([distance/2]).
%% This is an Erlang translation of Elixir's `String.jaro_distance/2'.
%% Upstream: https://github.com/elixir-lang/elixir/blob/v1.15.7/lib/elixir/lib/string.ex#L2784-L2879.
%% Jaro Distance is relatively simple - only transpositions of grapheme
%% clusters are allowed which is much simpler than other edit distance
%% measurements like Damerau–Levenshtein (insertion, deletion, substitution
@the-mikedavis
the-mikedavis / BUILD
Created January 19, 2023 16:14
Bazel resize exit MWE
load("//:defs.bzl", "build_run", "build_test")
build_run(name = "hello-run")
build_test(name = "hello-test")
@the-mikedavis
the-mikedavis / erlang.kak
Last active July 4, 2021 18:40 — forked from subsetpark/erlang.kak
A half-baked kakoune language file for erlang.
# Detection
# ---------
hook global BufCreate .*[.](erl|hrl|app\.src) %{
set-option buffer filetype erlang
}
hook global BufCreate .*/rebar.config %{
set-option buffer filetype erlang
}
@the-mikedavis
the-mikedavis / Makefile
Created August 24, 2018 15:55
Minimalistic Java Makefile
JFLAGS = -g
JC = javac
.SUFFIXES: .java .class
.java.class:
$(JC) $(JFLAGS) $*.java
CLASSES = \
main.java \
@the-mikedavis
the-mikedavis / README.md
Last active November 6, 2024 03:15
`ddrescue` a directory

ddrfind - ddrescue on a directory

A non-recursive approach to using ddrescue on a directory.

Chances are, if you have a currupted set of memory, it's not just a few files. It's probably a whole disk. Wanna save it? You can use ddrescue, but that doesn't work on directories, only files. If you want to use it on a whole big directory, you'll need to do each file one by one. That's exactly what this script does.

Installation

@the-mikedavis
the-mikedavis / README.md
Last active May 18, 2018 15:26
Mix.exs to ex_doc config file converter

mix.exs -> ex_doc config file

The Elixir documentation generator tool ex_doc doesn't accept a mix.exs file as a configuration file (probably because you can't compile it without editing it). This script opens the local mix.exs file, reads all the necessary portions, and finds some other info, and then prints out all the necessary ex_doc options to a config file.

Why?

This allows you to autogenerate docs without doing any (repetitive) lifting. If you have a whole bunch of projects,