Skip to content

Instantly share code, notes, and snippets.

@copecog
copecog / zfs_zoned_pve.md
Created January 2, 2024 20:57
Testing zfs zone'd datasets with Linux Containers under PVE

For debian12base2 CT under PVE

Container

  • Debian 12 (bookworm) with PVE/PBS APT sources added, primarily for matching ZFS userspace distrib, but also to optionally install any PVE/PBS components

APT Sources Host and CT

/etc/apt/sources.list

deb https://mirrors.xmission.com/debian bookworm main contrib non-free non-free-firmware
deb-src https://mirrors.xmission.com/debian bookworm main contrib non-free non-free-firmware

deb https://mirrors.xmission.com/debian bookworm-backports main contrib non-free non-free-firmware
(defun hash-table-find-object (object hash-table &key (depth 1) (test #'equal))
"Find first object under recursive linked hash-tables and return."
(declare (type hash-table hash-table) (type (integer 0 *) depth) (type function test))
(catch 'found (%hash-table-find-object object hash-table depth test)))
(defun %hash-table-find-object (object hash-table depth test)
(declare (type hash-table hash-table) (type (integer 0 *) depth) (type function test))
(labels ((test-or-recursion ()
(cond ((>= depth 2) #'(lambda (hash-value)
(%hash-table-find-object object hash-value (1- depth) test)))
(deftype transit-char () `(or character (eql ε)))
(defun transit-char-closure (fa-states-prev fa-states-next Δ transit-char)
"Starting with and including FA-STATES-PREV, add all states reachable by TRANSIT-CHAR via map data structure Δ, to (=>) FA-STATES-NEXT."
(declare (type sets:set fa-states-prev fa-states-next)
(type maps:map Δ)
(type transit-char transit-char))
(sets:set-do-elements (state-prev fa-states-prev fa-states-next); => fa-states-next
(unless (sets:set-get-element state-prev fa-states-next); If we haven't already looked at this state:
(sets:set-add-element state-prev fa-states-next); Add current state-prev state to fa-states-next.
(defun inter-args-p (inter-args)
(labels ((check-inter-args (inter-begin inter-end inter-args-rest)
(typecase inter-begin
(character (typecase inter-end
(character (when (char< inter-begin inter-end)
(if inter-args-rest
(check-inter-args (first inter-args-rest)
(second inter-args-rest)
(cddr inter-args-rest))
t)))))
@copecog
copecog / loop.lisp
Last active October 26, 2021 02:46
* (macroexpand '(loop for n from 1 to 10 and x = n collect `(,n ,x)))
(BLOCK NIL
(LET ((N 1) (X NIL))
(DECLARE (IGNORABLE X)
(IGNORABLE N)
(TYPE (AND REAL NUMBER) N))
(SB-LOOP::WITH-LOOP-LIST-COLLECTION-HEAD (#:LOOP-LIST-HEAD-894
#:LOOP-LIST-TAIL-895)
(TAGBODY
(SB-LOOP::LOOP-DESETQ X N)
@copecog
copecog / lexer.lisp
Last active October 26, 2021 21:13
A reglex example
;;;; Meta: Pastebin snippits from what I'm messing around with.
;;; Meta: Example "Reglex" or "Regular Lisp Expression"
(defparameter *reglex.lang.c.float*
'(conc (opt (lit #\+ #\-))
(or (conc (or (conc (plus (inter #\0 #\9))
(lit #\.)
(star (inter #\0 #\9)))
(conc (lit #\.)
(plus (inter #\0 #\9))))
@copecog
copecog / fibonacci.lisp
Created September 21, 2021 15:56
Using Fibonacci to test lisp implementations
(defpackage #:fibonacci
(:use #:common-lisp)
(:export #:fib-recur
#:fib-loop))
(in-package #:fibonacci)
(defgeneric fib-recur (nth)
(:documentation "Return the n'th Fibonacci Number using a recursive function.")
(:method ((nth integer))