Skip to content

Instantly share code, notes, and snippets.

@tkurtbond
tkurtbond / Oberon-3.rst
Created June 12, 2022 03:09
Translation of Oberon-3 document from OfrontPlus compiler

Oberon-3

A new experimental Oberon-3 dialect arose in the process of rethinking and improving the Ofront + translator. It is most similar to Component Pascal, so only the differences will be listed below.

Especially recommended for development for 8, 16 and 32-bit microcontrollers. Although it is perfectly adapted for development for 64-bit architectures.

@tkurtbond
tkurtbond / tpop_regexp.c
Last active July 1, 2022 21:07
Example regexp matcher from *The Practice of Programming*.
/* tpop_match.c -- The regexp matcher from *The Practice of Programming*. */
/* See: http://genius.cat-v.org/brian-kernighan/articles/beautiful */
/* This code is a simple regular expression matcher that implements
the following constructs:
c matches any literal character c
. matches any single character
^ matches the beginning of the input string
$ matches the end of the input string
@tkurtbond
tkurtbond / Match.Mod
Last active July 1, 2022 21:09
The regexp matcher from *The Practice of Programming*, translated to Oberon-2.
(* Match.Mod -- The regexp matcher from *The Practice of Programming*, translated to Oberon-2. *)
(* See: http://genius.cat-v.org/brian-kernighan/articles/beautiful *)
(* This code is a simple regular expression matcher that implements
the following constructs:
c matches any literal character c
. matches any single character
^ matches the beginning of the input string
$ matches the end of the input string
@tkurtbond
tkurtbond / generic.Mod
Created July 13, 2022 01:10
First stab at a generic linked list in Oberon-2
MODULE generic;
IMPORT Out;
TYPE ListItem = POINTER TO ListDesc;
ListDesc = RECORD
next: ListItem;
END;
IntegerItem = POINTER TO IntegerDesc;
@tkurtbond
tkurtbond / split_unbounded.adb
Last active August 1, 2022 13:32
An Ada procedure to split unbounded strings on a delimiter string with example of use.
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_Io;
with Ada.Text_IO.Unbounded_IO; use Ada.Text_IO.Unbounded_IO;
with Ada.Containers.Vectors;
procedure split_unbounded is
package Unbounded_String_Vectors is new
Ada.Containers.Vectors (Natural, Unbounded_String);
use Unbounded_String_Vectors;
@tkurtbond
tkurtbond / split_bounded.adb
Created August 1, 2022 13:37
An Ada procedure to split bounded strings on a delimiter string with example of use.
with Ada.Strings; use Ada.Strings;
with Ada.Strings.Bounded; use Ada.Strings.Bounded;
with Ada.Text_IO.Bounded_IO;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Containers.Vectors;
procedure split_bounded is
package B_String is new
Ada.Strings.Bounded.Generic_Bounded_Length (Max => 128);
use B_String;
@tkurtbond
tkurtbond / tkb-select-frame-popup.el
Created February 1, 2023 18:19
Emacs function to popup a menu to select a frame to bring the front.
(defun tkb-select-frame-popup ()
(interactive)
(let* ((frames (cl-loop for frame in (frame-list)
collect (cons (frame-parameter frame 'name)
frame)
into frames finally return frames))
(frame (x-popup-menu t `("Pick a frame" ("frames" ,@frames)))))
(when frame
(raise-frame frame)
(select-frame frame))))
@tkurtbond
tkurtbond / indent-cl-symbols.el
Created February 6, 2023 23:27
Make all the cl-* symbols indent properly in emacs lisp
(load-library "cl-indent") ; defines the common-lisp-indent-function properties
(setq lisp-indent-function 'common-lisp-indent-function)
(cl-loop for symbol being the symbols
for cl-indent-rule = (get symbol 'common-lisp-indent-function)
for elisp-equivalent = (intern-soft (concat "cl-" (symbol-name symbol)))
when (and cl-indent-rule elisp-equivalent (fboundp elisp-equivalent))
do (put elisp-equivalent 'common-lisp-indent-function cl-indent-rule))
@tkurtbond
tkurtbond / get-gemini-atom.scm
Last active March 5, 2023 17:04
Download the list of gemini atom feeds from gemini://gemini.circumlunar.space/capcom/submitted-feeds.txt and then download all the feeds.
(module get-gemini-atom ()
(import (scheme))
(import (chicken base))
(import (chicken file))
(import (chicken process-context))
(import (chicken condition))
(import (utf8))
(import args)
@tkurtbond
tkurtbond / tkb-bell.el
Created December 9, 2023 23:39
Set emacs up to ring the bell using an external program, since the normal beep/bell/ding doesn't seem to work any more.
(defvar tkb-beep-sound "/usr/share/sounds/freedesktop/stereo/bell.oga")
(defvar tkb-beep-program "ogg123")
(defun tkb-bell ()
(interactive)
(start-process "Beep" nil tkb-beep-program
tkb-beep-sound))
(setq ring-bell-function #'tkb-bell)