Skip to content

Instantly share code, notes, and snippets.

@oem
oem / test.py
Created July 4, 2018 11:25
sanity checking our trained beer classifier
import turicreate as tc
import os
current_dir = os.path.dirname(__file__)
model = tc.load_model(os.path.join(
current_dir, 'model/v1.model'))
images = tc.load_images(os.path.join(current_dir, 'data/test'))
images['predictions'] = model.predict(images)
images.print_rows(num_rows=10)
@oem
oem / day_6.jl
Created December 7, 2020 11:18
day 6, advent of code 2020, using Pipe
using Pipe: @pipe
getdata(file) = open(joinpath(@__DIR__, file)) do f read(f, String) end
part1(data) = @pipe data |>
split(_, "\n\n") |>
map(l -> replace(l, "\n" => ""), _) |>
map(l -> split(l, ""), _) |>
map(l -> unique(l), _) |>
map(l -> length(l), _) |>
@oem
oem / aoc2022-1.k
Last active December 1, 2022 09:41
|/n:+/'1_'(&^n)_n:`I$'0:"i/1"
+/n@3#>n