Skip to content

Instantly share code, notes, and snippets.

View RickCarlino's full-sized avatar
💾

Rick Carlino RickCarlino

💾
View GitHub Profile
@RickCarlino
RickCarlino / 01_results.txt
Last active February 3, 2024 04:45
(NOT PEER REVIEWED) My attempt to understand FSRS in Typescript
==== Simulate same grade 5 times in a row ====
====== AGAIN ======
┌─────────┬───────────────────┬─────────────────────┬─────────────────────┐
│ (index) │ D │ S │ I │
├─────────┼───────────────────┼─────────────────────┼─────────────────────┤
│ 0 │ 3.05 │ 0.4 │ 0.3999999999999999 │
│ 1 │ 4.771599999999999 │ 0.2771731229713308 │ 0.2771731229713307 │
│ 2 │ 6.475983999999999 │ 0.19535411986485177 │ 0.19535411986485174 │
│ 3 │ 8.16332416 │ 0.13925231677732938 │ 0.13925231677732935 │
│ 4 │ 9.833790918400002 │ 0.09996923095782838 │ 0.09996923095782835 │
@RickCarlino
RickCarlino / frequencylist.json
Created November 21, 2023 12:33
Korean freuqnecy list from random TOPIK exam
{
"하다": 416,
"있다": 409,
"예문": 292,
"사람": 221,
"남자": 186,
"여자": 164,
"좋다": 142,
"없다": 140,
"많다": 134,
@RickCarlino
RickCarlino / konilo.js
Last active May 10, 2023 12:55
Sandboxable Typescript Konilo (Same license as Konilo)
function enforce32BitSignedInteger(value) {
const int32Max = Math.pow(2, 31) - 1;
const int32Min = -Math.pow(2, 31);
value = value | 0;
value = (value - int32Min) % (int32Max - int32Min + 1) + int32Min;
return value;
}
class Konilo {
m; blocks; ds; as; ip; sp; rp; a; b; f; s; d; l; cycles; input; outputHandler;
constructor(romURL, blockURL) {
@RickCarlino
RickCarlino / konilo.md
Created May 6, 2023 03:21
Konilo interpreter optimization to not block event loop.

The Konilo interpreter execs byte code in a loop. The Javascript VM cannot do anything else while this loop is running unfortunately, so the browser is unresponsive until all bytecode has executed.

The modification below adds an artificial sleep() function that allows the event loop to catch its breath and service event handlers (eg: UI clicks, form interaction, unrelated AJAX calls, etc...)

The EVENT_LOOP_PAUSE_TICKS variable will need to be tuned to find a balance between initial load speed and UI responsiveness.

@RickCarlino
RickCarlino / parser.ts
Created May 3, 2023 12:19
Really simple Gemtext parser in Typescript
// Gemtext.ts
type TextNode = {
type: "text";
content: string;
};
type LinkNode = {
type: "link";
url: string;
title: string;
@RickCarlino
RickCarlino / the_real_origin_of_forth.md
Created December 25, 2022 23:10
I wish I could take credit for this, but OpenAI wrote the whole thing.

It was a dark and stormy night at the National Radio Astronomy Observatory. Chuck Moore, a computer programmer, was working late, trying to finish up a project for the observatory. As he sat at his desk, staring at his computer screen, he suddenly felt a strange feeling wash over him. As he closed his eyes, he found himself transported to a strange and alien world. He was standing on a rocky outcropping, looking out at a vast expanse of stars and galaxies. Suddenly, a group of tall, slender beings approached him. "Greetings, Chuck Moore," one of the beings said in a deep, booming voice. "We are the guardians of the universe, and we have come to you with a mission." Chuck was stunned. "Wh-what do you mean?" he stammered. "We have seen the great potential in your mind, Chuck," the being continued. "You have the ability to create something truly extraordinary. Something that will change the way humans communicate with computers forever." "What is it?" Chuck asked, his curiosity piqued. "We want you to invent a n

@RickCarlino
RickCarlino / formatter.rb
Created November 19, 2022 18:04
Daylio Journal Formatter ingests Daylio CSV export and produces Markdown / Gemtext
require "csv"
require "date"
output = []
File.open("raw.csv").each_line do |input_row|
begin
CSV.parse(input_row) do |(date, time, entry)|
if entry && date != "full_date"
a = "#{date} #{time}"

Cell Alignment Issues?

{{
  #15 'COL-SIZE const
  '_______________%n,%n| 'double-column s:const
  '_______________%n|    'num-column    s:const
  '_______________%c|    'char-column   s:const
  :formatted s:format COL-SIZE s:right s:put ;
 :show-char (n-) dup c:-visible? [ drop $. ] if char-column formatted ;
@RickCarlino
RickCarlino / whoops.md
Created July 30, 2022 22:51
Less-than-ideal API with `mem:*` words

Problem

Below I am using a mem:inspect word. It is not defined here, but it has the following signature: :mem:inspect (aa-) ... ;.

How I wish it worked

The following example would be nice, but in the real world, it causes a segfault:

#100 mem:alloc 'memory double:const
@RickCarlino
RickCarlino / example.md
Created February 3, 2022 16:54
Celeryscript example

Passing a Number to a Sequence

SCENARIO:

  • You have a sequence with an ID of 123.
  • The sequence exposes one numberic variable with a label of My number (capitalization is important).
  • You want to execute the sequence and pass a value of 456 to the variable.
{