Skip to content

Instantly share code, notes, and snippets.

View elbow-jason's full-sized avatar
🏠
Working from home

Jason Goldberger elbow-jason

🏠
Working from home
View GitHub Profile
@elbow-jason
elbow-jason / readme_as_moduledoc.ex
Created April 24, 2020 16:13
SNIPPET: readme as moduledoc
defmodule Thing do
# get the full qualified path to the README.
@readme_path Path.join(__DIR__, "../README.md")
# ensure the module recompiles if the README changes
# NOTE: @external_resource requires a fully qualified path.
@external_resource @readme_path
# read the README into the moduledoc
@moduledoc File.read!(@readme_path)
end
@elbow-jason
elbow-jason / kill_it_with_fire.docker.sh
Created May 23, 2020 17:44
Remove Docker from OSX
#!/bin/bash
# Uninstall Script
if [ "${USER}" != "root" ]; then
echo "$0 must be run as root!"
exit 2
fi
while true; do
@elbow-jason
elbow-jason / running_it.txt
Created November 5, 2020 20:48
Why are `fox3` and `the2` null?
~/W/z/playground $ zig version
0.6.0+342ba960f
~/W/z/playground $ zig build-exe tfidf.zig
~/W/z/playground $ ./tfidf
word "the" initialized to count 1
after word "the" map count is 1
word "quick" initialized to count 1
after word "quick" map count is 2
@elbow-jason
elbow-jason / iex.exs
Created February 17, 2021 20:04
Nx - get and set by index for rank1 tensors
iex(1)> t1 = Nx.tensor([3, 4, 5])
#Nx.Tensor<
s64[3]
[3, 4, 5]
>
iex(2)> Rank1.at(t1, 0)
#Nx.Tensor<
s64
3
>