Skip to content

Instantly share code, notes, and snippets.

View novusnota's full-sized avatar
:accessibility:
be curious, do better, and remember — it's more fun to be competent

Novus Nota novusnota

:accessibility:
be curious, do better, and remember — it's more fun to be competent
View GitHub Profile
@novusnota
novusnota / imaginary-book-club.md
Created January 11, 2025 16:49 — forked from jcreedcmu/imaginary-book-club.md
Imaginary Book Club

Welcome to imaginary book club! I hope everyone finished the reading this week. No? Fine, we'll just wing it. At least there's snacks.

There is a deck of cards. Each has a question on it. Play starts with a random player and proceeds in a circle, with each player drawing a card and answering the question. The first two are always:

  • What is the book's title?
  • What is the book's genre?
@novusnota
novusnota / ANSI.md
Created December 19, 2024 00:19 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@novusnota
novusnota / sat.md
Created December 7, 2024 20:59 — forked from VictorTaelin/sat.md
Simple SAT Solver via superpositions

Solving SAT via interaction net superpositions

I've recently been amazed, if not mind-blown, by how a very simple, "one-line" SAT solver on Interaction Nets can outperform brute-force by orders of magnitude by exploiting "superposed booleans" and optimal evaluation of λ-expressions. In this brief note, I'll provide some background for you to understand how this works, and then I'll present a simple code you can run in your own computer to observe and replicate this effect. Note this is a new observation, so I know little about how this algorithm behaves asymptotically, but I find it quite

@novusnota
novusnota / bash_strict_mode.md
Created December 3, 2024 14:50 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation
@novusnota
novusnota / tagless-final.rs
Created December 2, 2024 20:28 — forked from hirrolot/tagless-final.rs
Tagless-final encoding of a simple arithmetic language in Rust
trait Interp {
type Repr<T>;
fn lit(i: i32) -> Self::Repr<i32>;
fn add(a: Self::Repr<i32>, b: Self::Repr<i32>) -> Self::Repr<i32>;
}
struct Eval;
impl Interp for Eval {
@novusnota
novusnota / build.zig
Created May 5, 2024 22:43 — forked from gwenzek/build.zig
Building with Zig and system LLVM
const std = @import("std");
const Build = std.Build;
pub fn build(b: *Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
// Instead of using the classic b.addExecutable, we use a custom rule
// to compile with Zig, then optimize with LLVM.
const exe = addLLvmExecutable(b, .{
;; my_addr(MYADDR) get_jwa_method_id(103289) args(2) master_code ret(1) master_data
;; RUNVM +1 +4 +32
;; address exitcode c4' c5'
slice vm::invoke_get_addr(cell master_code, cell master_data) asm
"MYADDR // mc md my_addr"
"103829 PUSHINT // mc md my_addr get_jwa_method_id"
"2 PUSHINT // mc md my_addr get_jwa_method_id args"
"2 3 BLKSWAP // my_addr get_jwa_method_id args mc md"
"1 PUSHINT // my_addr get_jwa_method_id args mc md ret"
@novusnota
novusnota / min-char-rnn.py
Created April 9, 2024 17:49 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@novusnota
novusnota / add_this_snippet_to_your_fish_shell_config.fish
Created September 12, 2023 12:49
Simplest way of using https://sdkman.io/ under Fish Shell — add the snippet from the file below to your ~/.config/fish/config.fish and call it a day! No more how to use sdkman with fish issues, a simple wrapper is all you need.
# Simplest way of using https://sdkman.io/ under Fish Shell:
# Add the snippet from the file below to your ~/.config/fish/config.fish and call it a day!
# Note: while this trick works, it doesn't give you auto-completion options.
function sdk
bash -c "source '$HOME/.sdkman/bin/sdkman-init.sh'; sdk $argv[2..-1]"
end
@novusnota
novusnota / run.jl
Created October 27, 2022 11:28
A small Julia-based script, which allows usage of 'and' and 'or' keywords instead of '&&' and '||' infix operators in Julia programs.
#!/usr/bin/env julia
##
# A small script, written in Julia, which allows usage of 'and' and 'or' keywords instead of '&&' and '||' infix operators in Julia programs.
# Made out of desperation after reading this discussion: https://github.com/JuliaLang/julia/issues/5238
# Notice, that run.jl **doesn't** modify the original file.
#
# Use it simply so:
# $> julia run.jl <filename>
# or by giving the file execution rights and then running: