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])
# =>