Skip to content

Instantly share code, notes, and snippets.

@Oldes
Oldes / new-rebol-extension.r3
Last active August 8, 2024 14:20
Prepare a new Rebol extension project
Rebol [
title: "Prepare a new Rebol extension project"
needs: 3.7.0 ;; because it is using ZIP codec
]
ext-name1: ask "Name of the new extension (uppercase without `Rebol-` part): "
ext-name2: lowercase copy ext-name1
ext-root: join %Rebol- ext-name1
;; Check if there is already a project with this name.
@Oldes
Oldes / pandore.reb
Created June 27, 2024 07:40
Pandore library file codec
Rebol [
name: pandore
title: "Codec: PAN"
version: 0.0.1
purpose: "Decode data from Pandore library files"
note: https://clouard.users.greyc.fr/Pandore/
]
register-codec [
name: 'pandore
@Oldes
Oldes / sort-versions.reb
Last active March 7, 2024 10:15
Sorts block of semantic versioning strings with applied Maven exceptions
Rebol [
Name: semantic-version
Type: module
Purpose: "Sorts block of semantic versioning strings with applied Maven exceptions"
Exports: [sort-versions compare-versions]
Usage: [
sort-versions ["2-alpha" "2.0" "1" "2-sp" "1.2" "2-beta" "2-rc1" "2-rc2"]
;== ["1" "1.2" "2-alpha" "2-beta" "2-rc1" "2-rc2" "2.0" "2-sp"]
]
Version: 1.0.0
@Oldes
Oldes / dmx-port.r3
Created March 6, 2024 20:47
Cross-platform DMX port usage example
Rebol [
Purpose: "Cross-platform DMX port usage example"
Needs: 3.11.0 ;= https://github.com/Oldes/Rebol3/releases/tag/3.11.0
]
;------------- DMX ------------------------
dmx-ctx: context [
ser: none
bin: make binary! 513 insert/dup bin 0 513
;- Channel 10A
@Oldes
Oldes / graph2d.r3
Last active March 24, 2023 18:37
Graphing 2D Equations using Rebol/MathPresso extension
REBOL [
title: "Graphing 2D Equations"
file: %graph2d.r3
purpose: {
Demonstrate use of Rebol/MathPresso extension.
Using precompiled math expression.
https://github.com/Siskin-framework/Rebol-MathPresso
}
reference: https://p5js.org/examples/math-graphing-2d-equations.html
license: MIT
@Oldes
Oldes / primitive-v2.reb
Last active March 23, 2023 23:50
Reproducing images with geometric primitives. Using curves.
REBOL [
Title: "Reproducing images with geometric primitives."
type: module
name: primitive
date: 24-Mar-2023
author: "Oldes"
version: 0.2.0
license: MIT
purpose: {This is a try to have something like this https://github.com/fogleman/primitive}
exports: [primitivize]
@Oldes
Oldes / primitive.reb
Last active June 24, 2024 07:29
Reproducing images with geometric primitives
REBOL [
Title: "Reproducing images with geometric primitives."
type: module
name: primitive
date: 24-Mar-2023
author: "Oldes"
version: 0.2.0
license: MIT
purpose: {This is a try to have something like this https://github.com/fogleman/primitive}
exports: [primitivize]
@Oldes
Oldes / new-rebx.r3
Created March 22, 2023 10:49
Rebol extension source code template generator
REBOL [
title: "Rebol extension source code template generator"
]
system/options/quiet: false
system/options/log/siskin: 3
;- File templates --------------------------------------------------------------
rebol-extension.r3: {REBOL [
title: "Rebol/#NAME# module builder"
type: module
@Oldes
Oldes / random-names.reb
Created December 27, 2022 11:55
Random names generator scheme
REBOL [
Title: "Random names"
type: module
name: random-names
version: 0.0.1
author: @oldes
exports: [random-names]
]
;; https://britishsurnames.co.uk/random
@Oldes
Oldes / my-ip.r3
Created April 10, 2022 12:57
Resolve external IP address
Rebol []
my-ip?: function[
"Resolves external IP address"
][
quiet: system/options/quiet
system/options/quiet: true
host-name: read dns://
local-ip: read join dns:// host-name
external-ip: read http://ifconfig.me/ip
system/options/quiet: quiet