Skip to content

Instantly share code, notes, and snippets.

@tynanbe
tynanbe / out.txt
Created February 19, 2024 20:17
Euclidean distance with Argamak
Input: Tensor(
Format(Float32),
Space(Axis("Note", 1), Axis("Relevancy", 3)),
[[ 3.0, -5.0, 4.0]],
)
Notes: Tensor(
Format(Float32),
Space(Axis("Note", 3), Axis("Relevancy", 3)),
[[ 1.0, 0.0, 3.0],
@tynanbe
tynanbe / race.gleam
Created January 29, 2024 22:10
Slide-friendly Argamak example
import gleam/io
import gleam/list
import argamak/axis.{Axis, Infer}
import argamak/space
import argamak/tensor
const horses = ["Pony Express", "Hay Girl", "Low Rider"]
const day1 = [1.2, 1.3, 1.3, 1.0, 1.5, 0.9]
@tynanbe
tynanbe / read_line_sync.ts
Created January 20, 2024 03:04
Sync read line FFI for Gleam
import type { List } from "../prelude.d.mts";
import { toList } from "../prelude.mjs";
type Nil = undefined;
const Nil = void 0;
const { fs, process } =
await (async () =>
!globalThis.Deno
? {
@tynanbe
tynanbe / qtype
Created January 11, 2024 22:41
The quiet type
#!/bin/sh
#
# Quietly queries how each name would be interpreted if used as a command name
#
# Usage: qtype ...<name>
#
# Description:
# Exits successfully when every name is found.
#
set -eu
@tynanbe
tynanbe / colorless.toml
Created December 7, 2023 01:42
A mostly colorless theme for the Helix text editor.
# Author: tynanbe <contact@tynan.be>
"attributes" = ""
"comment" = ""
"constant" = ""
"constant.builtin" = ""
"constant.character.escape" = ""
"constant.numeric" = ""
"constructor" = ""
"function" = ""
@tynanbe
tynanbe / deno_lsp_or_tsls
Created November 7, 2023 23:03
POSIX shell scripts and Helix config to auto-select when to use Deno, TS LS, and/or Prettier for the current file. Bonus script to auto-update Helix grammars.
#!/bin/sh
#
# Runs `deno lsp` if a Deno configuration file is found, otherwise runs
# `typescript-language-server`
#
# Usage: deno_lsp_or_tsls ...[arguments]
#
# This script is intended to be run by the Helix editor, or any other editor
# that includes the current buffer's filename as the final field in its process
# command line.
@tynanbe
tynanbe / dynamic_demo.gleam
Last active October 22, 2023 23:25
Proposed Gleam tuple spread syntax, Erlang target proof of concept
import gleam/dynamic.{DecodeErrors, Dynamic, field, int, list, string}
import gleam/io
import gleam/json
import gleam/list
import gleam/result
type DynResult(a) =
Result(a, DecodeErrors)
pub opaque type Collector(a) {
@tynanbe
tynanbe / dynamic_demo.gleam
Last active May 15, 2024 06:21
Proposed Gleam tuple spread syntax
import gleam/dynamic.{DecodeErrors, Dynamic, field, int, list, string}
import gleam/io
import gleam/json
import gleam/list
import gleam/result
type DynResult(a) =
Result(a, DecodeErrors)
pub opaque type Collector(a) {
@tynanbe
tynanbe / index.html
Created January 26, 2021 19:00
Local example: gleam docs publish --version 0.1.0
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>shellout - shellout</title>
<link rel="stylesheet" href="../index.css" type="text/css" />
<!-- The docs_config.js file is provided by HexDocs and shared
between multiple versions of the same package. -->
<script src="../docs_config.js"></script>
@tynanbe
tynanbe / xst-ligatures-0.8.4.patch
Created December 6, 2020 06:13
Ligature support for xst
diff --git a/Makefile b/Makefile
index 3bb1b7f..38634a4 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@
include config.mk
-SRC = st.c x.c boxdraw.c
+SRC = st.c x.c boxdraw.c hb.c