This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mix.install([{:axon, "~> 0.6"}, {:nx, "~> 0.7"}, {:exla, "~> 0.7"}, {:stb_image, "0.6.6"}, {:kino, "~> 0.8"}]) | |
defmodule CatsAndDogs do | |
def pipeline(paths, batch_size, target_height, target_width) do | |
paths | |
|> Enum.shuffle() | |
|> Task.async_stream(&parse_image/1) | |
|> Stream.filter(fn | |
{:ok, {%StbImage{shape: {_, _, 3}}, _}} -> true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule GpioInput do | |
use GenServer | |
@item_in_pin 17 | |
def start_link() do | |
GenServer.start_link(__MODULE__, [], []) | |
end | |
def init(_) do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Turtle | |
DIRECTIONS = [:UP, :RIGHT, :DOWN, :LEFT] | |
def initialize(size) | |
@size = size | |
@array = Array.new(size) | |
@array.map! {|line| line = Array.new(size, " ")} | |
@direction = :RIGHT | |
@x = 0 | |
@y = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Sublist do | |
defp count(l) do | |
count(l,0) | |
end | |
defp count([], size) do | |
size | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I have : | |
Router.map(function() { | |
this.resource('dashboards', { path: '/' }, function() { | |
this.resource('dashboardsEdit', {path: ':id'}, function() { | |
this.route('newWidget', {path: 'new'}); | |
}); | |
}); | |
}); |