Skip to content

Instantly share code, notes, and snippets.

View klange's full-sized avatar
🤔
Contemplative.

K Lange klange

🤔
Contemplative.
View GitHub Profile
/**
* @brief Pairing heap.
* @file module__pheap.c
* @author K. Lange <klange@toaruos.org>
*
* A very simple pairing heap.
*
* Provides a min-heap with insert, peek, and pop.
*
* While heap entries may be mutable, care should be taken not to modify
@klange
klange / _.md
Last active April 19, 2024 16:24
12 Years of ToaruOS

12 Years of ToaruOS

This is a repost and update to an imgur album with screenshots of ToaruOS throughout its development, as imgur is no longer a viable platform for maintaining this collection.

Early Development

My first commit in the ToaruOS repository, ecd4fe2bc170b01ad700ff76c16da96993805355, was made on January 15th, 2011. This date has become ToaruOS's "birthday". It would be another six years and two weeks before ToaruOS's first real release, 1.0.

1 - eL4aHBZ - Humble Beginnings

@klange
klange / toaru.c
Last active October 27, 2021 07:17
#include "os.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <toaru/yutani.h>
#include <toaru/graphics.h>
#include <toaru/decorations.h>
#include <toaru/menu.h>
Test script running on Misaka 1.99.8-3decb961-dirty only my railgun Oct 21 2021 15:40:36 (x86_64), Kuroko 1.2.0
====
ahci: located device at 0x1f02
ahci: examining PCI config space...
ahci: interrupt line = 10
ahci: BAR5 = 0xfebd9000
ahci: mapping mmio to 0xffffff1fc0001000
ahci: implemented ports = 0x3f
ahci: version 1.00
ahci: Telling host controller we are aware of it.
>>> True or explode()
<<module>() from <stdin>>
1 0 TRUE
1 JUMP_IF_TRUE_OR_POP 4 (to 8)
4 GET_GLOBAL 0 'explode'
6 CALL 0
>> 8 POP
2 9 GET_LOCAL 0
11 RETURN
#include <stdio.h>
struct Base {
int foo;
int bar;
};
struct Sub {
struct Base;
int baz;
Corrupt bytes iterator: %s
corrupt Directory
corrupt enumerate object
Corrupt File
corrupt filter object
Corrupt list iterator: %s
corrupt map object
Corrupt str iterator: %s
wget -O kuroko.zip https://github.com/kuroko-lang/kuroko/archive/master.zip; unzip kuroko.zip
wget -O bim.zip https://github.com/klange/bim/archive/master.zip; unzip bim.zip
pushd kuroko-master
make CFLAGS="-std=gnu99 -O3"
sudo make install prefix=/usr libdir=/usr/lib64
popd
kuroko --version
pushd bim-master
make
sudo make install
@klange
klange / sandbox.c
Created January 31, 2021 01:01
Kuroko Sandbox Demo
#include <stdio.h>
#include "src/vm.h"
#define S(c) (krk_copyString(c,sizeof(c)-1))
int main(int argc, char * argv[]) {
if (argc < 2) {
fprintf(stderr, "expected a string to evaluate\n");
return 1;
}
>>> l[1]++
| [ *<closure <def <module>>> ]
0000 1 OP_GET_GLOBAL 0 '"l"' (type=String)
| [ *<closure <def <module>>> ][ <instance of list> ]
0002 | OP_DUP 0
| [ *<closure <def <module>>> ][ <instance of list> ][ <instance of list> ]
0004 | OP_CONSTANT 1 '1' (type=Integer)
| [ *<closure <def <module>>> ][ <instance of list> ][ <instance of list> ][ 1 ]
0006 | OP_SWAP 1
| [ *<closure <def <module>>> ][ <instance of list> ][ 1 ][ <instance of list> ]