Skip to content

Instantly share code, notes, and snippets.

@sogaiu
sogaiu / i-use-these.md
Last active February 13, 2026 04:37
what i use in janet (write code to extract from projects?)
  • array/push
  • assertf
  • case
  • cond
  • deep=
  • def
  • defn
  • empty?
  • eprintf
  • errorf
@sogaiu
sogaiu / gist:4cd497e439c319c2e750b4136317b6d9
Created February 6, 2026 13:04
rebol stuff that might be worth looking at for additional peg specials in janet
https://www.rebol.com/r3/docs/concepts/parsing-summary.html
(defn capture-empty-element
[& args]
(def sname (first args))
(case (length args)
0 (errorf "expected one or more args, got 0")
#
1 {:tag sname}
#
{:tag sname
:attrs (table ;(drop 1 args))}))
#! /usr/bin/env janet
# based on:
#
# https://codeberg.org/veqq/rss-reader/src/branch/master/rss-reader.janet
# usage: pass feed urls on command line
# requirements:
#
@sogaiu
sogaiu / notes.md
Created February 4, 2026 14:08
jpm, janet-pm, etc.
@sogaiu
sogaiu / notes.md
Last active February 1, 2026 13:18
sm-n981n note 20 5g
  • basic info

    • model code (from Settings -> About phone -> Status Information): SM-N981NZNEKOO

    • looks like qualcomm snapdragon 8250 (via CPU Info app)

    • specs

    • twrp

(defn visit
``
Traverse directory tree starting at `path`, applying
argument `a-fn` to each encountered file or directory path.
``
[path a-fn]
(assertf (is-dir? path)
"expected dir but got: %n" (os/stat path :mode))
(def seen? @{})
#
@sogaiu
sogaiu / tidbits.janet
Last active January 31, 2026 06:05
janet tidbits
# `(next x)` can be used as a synonym for `(not (empty? x))`
# if `next` returns `nil`, the argument is empty.
(next [])
# =>
nil
# if `next` returns non-nil, the argument is not empty.
(next [:a :b])
# =>

2026-02-14

  • Excerpt from "The Dawn of Everything"

    If, as many are suggesting, our species’ future now hinges on our capacity to create something different (say, a system in which wealth cannot be freely transformed into power, or where some people are not told their needs are unimportant, or that their lives have no intrinsic worth), then what ultimately matters is whether we can rediscover the freedoms that make us human in the first place. As long ago as 1936, the prehistorian V. Gordon Childe wrote a book called Man Makes Himself. Apart from the sexist