Skip to content

Instantly share code, notes, and snippets.

@sogaiu
sogaiu / notes.md
Last active August 23, 2025 13:18
numbers and memory
  • ascii (0 - 127 = 128)
  • unicode hiragana (0x3040 - 0x309f -> 16 * 6 = 96 -- there are currently 3 blanks)
  • unicode hangul (0x1100 - 0x11ff -> 16 * 16 = 256 -- HCF (Hangul Choseong Filler) 0x115f [1] and HJF (Hangul Jungseong / Jongseong (?) Filler) 0x1160 [2])
  • periodic table (atomic number)
  • first n days of the year (as calendar dates - though don't forget february 29 (day 60 = 31 + 29))
  • i-ching

may be not good because could change...

@sogaiu
sogaiu / gist:617352a0623e827b2b3df579246e2c4b
Created August 12, 2025 10:10
janet support in rouge notes
hex string escapes missing
missing upscope
@specials ||= Set.new %w(
break def do fn if quote quasiquote splice set unquote var while
)
hex handling missing things like 0x2.
rule %r/[+-]?0x\h[\h_]*(\.\h[\h_]*)?/, Num::Hex
rule %r/[+-]?0x\.\h[\h_]*/, Num::Hex
@sogaiu
sogaiu / random-all-the-way-down-and-cscheck-notes.md
Last active August 13, 2025 12:12
random all the way down and cscheck notes

questions and notes

  • what's the basic idea in cscheck? answer from "random all the way down" article:

    The idea is simple: instead of coming up with a deliberate algorithm to make values smaller, we just - in technical terms - throw shit to the wall and see what sticks. That is, we're already counting on random generation to find bugs, let's also randomly try to find smaller values that still make our test fail.

    Unlike the shrinking strategies we've seen so far, which produce a limited number of smaller values to try, this new approach can keep trying forever. If the random generator is "random enough", a good shrink should show up at some point.

> In practice, that can take too long, especially if the test itself is slow. However, we can avoid running a test, or even generating an actual value, by calculating the size of the value that we're about to generate beforehand. We'll keep the size of the smallest valu

@sogaiu
sogaiu / some-peg-stuff.janet
Last active August 11, 2025 12:54
some peg work
(def g0
~{:main (* (any (+ (group :delim) (group :pre) (group :raw) ':ch)) -1)
:ch (+ (* `\` 1) 1)
:ws (+ :s -1)
:delim (+ :st-delim :em-delim :ln-delim)
:st-delim (+ (* (constant :open) '(+ "**" "__") (not :ws))
(* (constant :close) '(+ "**" "__") (not (> -3 :ws))))
:em-delim (+ (* (constant :open) '(+ "*" "_") (not :ws))
(* (constant :close) '(+ "*" "_") (not (> -2 :ws))))
:ln-delim (+ (* (constant :open) '"[")
@sogaiu
sogaiu / c-resources.md
Last active August 10, 2025 12:18
c resources
@sogaiu
sogaiu / gist:1bf9ae6a09bad42834408443e19d2f3d
Created August 4, 2025 00:11
connecting ssds externally
https://graugear.de/en/
https://pmc.ncbi.nlm.nih.gov/articles/PMC8197712/
@sogaiu
sogaiu / gist:46af2346af9acab2284a55fbb61deb38
Created August 2, 2025 09:37
verifying backup integrity
compute and collect checksums:
cd target-directory
time find . -type f -print0 | xargs -0 md5sum > checksums.md5
verify:
time md5sum -c checksums.md5 > result.txt
adapted from: https://info.michael-simons.eu/2008/10/25/recursively-md5sum-all-files-in-a-directory-tree/