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
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 | |
> |
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
~/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 |
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
#!/bin/bash | |
# Uninstall Script | |
if [ "${USER}" != "root" ]; then | |
echo "$0 must be run as root!" | |
exit 2 | |
fi | |
while true; 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
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 |
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
iex(1)> cells = SparseCells.build([cell_1: ["a", "b"], cell_2: [1, 2], cell_3: ["w", "x", "y", "z"]]) | |
%SparseCells{ | |
key_sizes: [cell_1: 2, cell_2: 2, cell_3: 4], | |
map: %{ | |
{:cell_1, 0} => "a", | |
{:cell_1, 1} => "b", | |
{:cell_2, 0} => 1, | |
{:cell_2, 1} => 2, | |
{:cell_3, 0} => "w", | |
{:cell_3, 1} => "x", |
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
x = nil | |
# Q: What is x? | |
# Q: What type is it? | |
# Q: What does it represent? |
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
alias Ecto.Changeset | |
defmodule Poly1 do | |
use Ecto.Schema | |
embedded_schema do | |
field(:key1, :string) | |
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
defmodule MultisortDecimalTest do | |
use ExUnit.Case | |
@data [ | |
%{multiplier: Decimal.from_float(1.0), points: Decimal.from_float(400.0)}, | |
%{multiplier: Decimal.from_float(1.0), points: Decimal.from_float(500.0)}, | |
%{multiplier: Decimal.from_float(0.9), points: Decimal.from_float(600.0)}, | |
%{multiplier: Decimal.from_float(0.9), points: Decimal.from_float(700.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
use std::thread; | |
use std::time as timing; | |
use time; | |
use std::fs; | |
use std::io; | |
use std::io::BufRead; | |
static DB_PATH: &str = "./file.db"; |
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
# Redis Cheatsheet | |
# All the commands you need to know | |
redis-server /path/redis.conf # start redis with the related configuration file | |
redis-cli # opens a redis prompt | |
# Strings. |
NewerOlder