Skip to content

Instantly share code, notes, and snippets.

package kafka.server
import (
"context"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
@hodzanassredin
hodzanassredin / Asm.Mod
Created June 26, 2024 10:06
Find module and proc by addr
MODULE TestModules;
IMPORT SYSTEM, Log := StdLog, Kernel;
CONST adr = 43711E10H;
PROCEDURE Do*;
VAR m : Kernel.Module;addr : INTEGER;
BEGIN
m := Kernel.modList;
@hodzanassredin
hodzanassredin / GithubIssues.Mod
Last active June 26, 2024 08:23
Blackbox implementation for issues load from github
MODULE TestJson;
IMPORT Log, W3cObjects, HttpClient, W3cStreams, W3cJSON, Strings, Meta, HttpParser, AosStreams;
TYPE
Issue* = POINTER TO RECORD
url*, title*: ARRAY 64 OF CHAR;
id*: INTEGER;
END;
Issues = POINTER TO ARRAY OF Issue;
@hodzanassredin
hodzanassredin / Interface.Mod
Created November 23, 2023 12:48
Interfaces in Component Pascal
MODULE Interfaces;
IMPORT StdLog;
TYPE
MultiRec* = POINTER TO ABSTRACT RECORD END;
InterfacePrototype* = POINTER TO ABSTRACT RECORD END;
Iterator* = POINTER TO ABSTRACT RECORD(MultiRec) END;
@hodzanassredin
hodzanassredin / GcmMode.cs
Created July 30, 2023 20:02
GCM mode single file, pure C# based on https://github.com/bcgit/bc-csharp
using System;
using System.Diagnostics;
using System.Numerics;
using System.Text;
namespace Org.BouncyCastle.Crypto.Modes
{
internal static class Check
{
internal static void DataLength(bool condition, string message)
@hodzanassredin
hodzanassredin / unsigned.mod
Last active June 15, 2023 15:39
implementation of unsigned for CP
MODULE CryptoUnsigned;
IMPORT SYSTEM, StdLog;
TYPE
UNSIGNED8 = BYTE;
UNSIGNED16 = SHORTINT;
UNSIGNED32 = INTEGER;
UNSIGNED64 = LONGINT;
@hodzanassredin
hodzanassredin / paket.mod
Created May 12, 2023 21:22
poc of packages manager for bb
MODULE PaketView;
IMPORT Dialog, Strings, StdLinks, HyperHttp, TextRulers, Ports, Views, Files, TextViews, StdTextConv, TextControllers, TextModels, TextMappers, Stores, StdLog, StdCoder, Converters;
TYPE Package* = RECORD
data: ARRAY 4 OF TextMappers.String;
isInstalled : BOOLEAN;
depends : PackageList;
END;
PackageList = POINTER TO RECORD
package: Package;
@hodzanassredin
hodzanassredin / curry.mod
Created May 10, 2023 09:44
component pascal currying example
TYPE Vector* = POINTER TO ARRAY OF REAL;
Mapper2 = PROCEDURE (x,y:Vector) : Vector;
Mapper = POINTER TO ABSTRACT RECORD END;
Closure = POINTER TO RECORD (Mapper)
f : Mapper2;
x : Vector;
END;
PROCEDURE (m:Mapper) Apply(v : Vector) : Vector , NEW, ABSTRACT;
@hodzanassredin
hodzanassredin / clockhouse.mod
Created May 7, 2023 10:58
blackbox clickhouse http
MODULE HttpCmds;
(* This module provides the commands required to start and configure a singleton http or https server
and shows how to provide a REST API for Component Pascal modules.
It also includes an http test client.
For the REST API it implements a servlet (MyServlet) that can be registered with an http or https server e.g. under
the URI prefix /. With 'http://localhost/calc?x=1&y=2' a procedure Calc is called and its result returned in XML format.
The special request 'testPOST' opens a form that allows to call Calc by means of a POST method.
2016-07-26, Josef Templ, first version
@hodzanassredin
hodzanassredin / Graph.mod
Last active May 10, 2023 13:25
learning black box
MODULE LinalgGraph;
IMPORT v :=LinalgVector, p:= LinalgPolygon, Views, Ports, StdLog, Strings, Fonts, TextControllers, TextMappers,Properties;
CONST pointSize = Ports.point * 20;
TYPE
View = POINTER TO RECORD (Views.View) END;
Polygons* = POINTER TO RECORD
polygon* : p.Polygon;
next* : Polygons;