Skip to content

Instantly share code, notes, and snippets.

This pangram lists
4, 1, 1, 2, 29, 8, 3, 5, 11, 1, 1, 3, 2, 22, 15, 2, 1, 7, 26, 19, 4, 5, 9, 2, 4, 1
-----
This first pangram has
5, 1, 1, 2, 29, 6, 4, 8, 12, 1, 1, 3, 2, 19, 12, 2, 1, 8, 26, 20, 3, 5, 9, 3, 4, 1
This second pangram totals
5, 1, 2, 3, 29, 6, 4, 7, 10, 1, 1, 2, 2, 21, 16, 2, 1, 8, 28, 23, 4, 4, 9, 3, 5, 1
@tuzz
tuzz / microcode.ino
Created December 30, 2024 21:58
Arduino Microcode Programmer - For my variation of Ben Eater's 8-bit computer
/**
* This sketch programs the microcode EEPROMs for the 8-bit breadboard computer
* It includes support for a flags register with carry and zero flags
* See this video for more: https://youtu.be/Zg1NdPKoosU
*/
#define SHIFT_DATA 2
#define SHIFT_CLK 3
#define SHIFT_LATCH 4
#define EEPROM_D0 5
#define EEPROM_D7 12
@tuzz
tuzz / decimal_decoder.ino
Last active September 8, 2024 16:27
Arduino EEPROM Programmer - Signed and unsigned decimal decoder
// Based on https://www.youtube.com/watch?v=dLh1n2dErzE
#define SHIFT_DATA 2
#define SHIFT_CLK 3
#define SHIFT_LATCH 4
#define EEPROM_D0 5
#define EEPROM_D7 12
#define WRITE_EN 13
void setAddress(int address, bool outputEnable) {
@tuzz
tuzz / Cargo.toml
Last active March 17, 2021 16:05
A proof of concept that uses the Sliding Puzzle crate to search for words.
[package]
name = "sliding_puzzle_message"
version = "0.1.0"
authors = ["Chris Patuzzo <[email protected]>"]
edition = "2018"
[dependencies]
sliding_puzzle = "*"
pathfinding = "*"
@tuzz
tuzz / invisible_text.pdf
Created December 6, 2020 14:02
A PDF that contains an invisible '24. a.' list item.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tuzz
tuzz / miracle-sudoku-tweet-solver.snt
Created August 13, 2020 22:36
A quick Sentient program to solve a sudoku posted in a tweet
# A quick Sentient program to solve the sudoku posted in this tweet:
# https://twitter.com/crypticcracking/status/1293897459912056833
function main () {
array9<array9<int5>> sudoku;
sudoku.each(function (row) {
invariant row.uniq?;
invariant row.all?(function (n) {
[package]
name = "foo"
version = "0.1.0"
edition = "2018"
[dependencies]
legion = "0.2.4"
@tuzz
tuzz / gaussian
Last active May 3, 2020 11:36
Generate the weights/offsets for an efficient two-pass Gaussian blur filter of different sizes.
#!/usr/bin/env ruby
# Generate the weights/ offsets for an efficient two-pass Gaussian blur filter of different sizes.
# Based on: http://rastergrid.com/blog/2010/09/efficient-gaussian-blur-with-linear-sampling/
#
# Usage: ./gaussian [epsilon]
require "bigdecimal/util"
EPSILON = Float(ARGV[0] || 0.05)
@tuzz
tuzz / web_sys_event_handler.rs
Created April 19, 2020 10:04
A convenience wrapper for handling events in Rust using web_sys
// The EventHandler::new method takes three arguments:
//
// 1) The Rust function to call to handle the event
// 2) The registration function
// 3) The deregistration function
//
// The deregistration function is called when the EventHandler is dropped.
// This is similar to React's useEffect cleanup pattern.
pub struct EventHandler {
int8 m, n, p, q;
m2 = m.square;
n2 = n.square;
p2 = p.square;
q2 = q.square;
# ceil(log2(sqrt((2 ** (bits - 1)) ** 2 ** 2 * 3)) + 1)
int16 inner, outer1, outer2;
int2 i;