Skip to content

Instantly share code, notes, and snippets.

View Kreijstal's full-sized avatar
↗️

Kreijstal Kreijstal

↗️
View GitHub Profile
@Kreijstal
Kreijstal / dm_pkg.sv
Last active July 8, 2024 14:12
verilator
/* Copyright 2018 ETH Zurich and University of Bologna.
* Copyright and related rights are licensed under the Solderpad Hardware
* License, Version 0.51 (the “License”); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://solderpad.org/licenses/SHL-0.51. Unless required by applicable law
* or agreed to in writing, software, hardware and materials distributed under
* this License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
@Kreijstal
Kreijstal / pi_calculus_excerpt.md
Created July 5, 2024 11:19
I need to read this on phone

Introduction to Part III

A type system is, roughly, a mechanism for classifying the expressions of a language. Type systems for programming languages, sequential and concurrent, are useful for several reasons, most notably:

(1) to detect programming errors statically (2) to extract information that is useful for reasoning about the behaviour of programs (3) to improve the efficiency of code generated by a compiler (4) to make programs easier to understand.

Types are an important part of the theory and of the pragmatics of the $\pi$-calculus, and they are one of the most important differences between $\pi$-calculus and CCS-like languages. Many of the type systems that have been studied for the $\pi$-calculus were suggested by well-known type systems for sequential languages, especially $\lambda$-calculi. In addition, however, type systems specific to processes have been proposed, for instance for preventing certain forms of interference among processes or certain forms of deadlock.

@Kreijstal
Kreijstal / binaryparsercombinator.js
Last active April 30, 2024 22:20
binary parser combinator js
function Result(tag, value) {
this.tag = tag;
this.value = value;
}
Result.ok = function(value) {
return new Result("ok", value);
};
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
(function (global){(function (){
'use strict';
var possibleNames = require('possible-typed-array-names');
var g = typeof globalThis === 'undefined' ? global : globalThis;
/** @type {import('.')} */
module.exports = function availableTypedArrays() {
@Kreijstal
Kreijstal / parsercombinator.py
Created April 10, 2024 11:15
something minimal I took ir from another website and expanded from there
import typing as tp
import operator
# Defining the basic parser structure
ParserP = tp.Callable[[str], tp.Tuple[tp.Any, str]]
# Defining the ParserError for exception handling
class ParserError(Exception):
def __init__(self, msg, content):
super().__init__(f"{msg}: {content}")
@Kreijstal
Kreijstal / canlink.py
Last active March 10, 2024 23:56
can link
@Kreijstal
Kreijstal / llmbenchmarks.txt
Created March 4, 2024 15:43
trying to make my own test set to check how good llms are
q:
```
The motion of a robot with a single prismatic joint can be modeled as: mq̈ + bq̇ + kq = f,
which depends on mass m = 2, stiffness k = 4, and friction b = 4.
We want to set the control force f = -kpx - kvẋ so that the controlled system is critically damped and has a closed-loop stiffness of k' = 8.
(Hint: a natural system is critically damped when b = 2√(mk.))
@Kreijstal
Kreijstal / NDTapeTuringMachine.py
Last active January 27, 2024 15:15
State Machine and automata, enjoy
class NDTreeNode:
def __init__(self, state, tapes, head_positions, parent=None):
self.state = state
self.tapes = tapes
self.head_positions = head_positions
self.parent = parent
self.children = []
class NDTapeTuringMachine:
def __init__(self, states, transitions, start_state, accept_state, blank_symbol, num_tapes):
@Kreijstal
Kreijstal / winapi.rs
Created April 4, 2023 16:31
Difference between rust winapi and windows-rs
use std::ptr::null_mut;
use winapi::shared::{
minwindef::{HIWORD, LOWORD, LPARAM, LRESULT, UINT, WPARAM},
windef::{HWND, POINT, RECT},
};
use std::ffi::CString;
use winapi::shared::basetsd::LONG_PTR;
use winapi::um::wingdi::GetStockObject;
use winapi::um::wingdi::SYSTEM_FONT;

https://www.theatlantic.com/technology/archive/2022/12/chatgpt-openai-artificial-intelligence-writing-ethics/672386/ https://showgpt.co/

Input:Bescheribt mal Köln auf Kölsch. Schreib es im Kölsch Dialekt.
Output:Kölle es en jode Stadt. Do es dat Rhing met de Dom un de Böög, un vill schöne Pläz met Jroeß un Veedel. Do es och vill Museeje un Gallereje, un en de Altstadt es immer jot beschäftich. Et es immer spannend, wann et Käävvejööch es, un et kütt noch janz vill Leute, för de Kölsche Dääch un de fööne Mädcher. Et es en jode Stadt för Lebensfreude un Kultur.

Input: Was bedeutet "Käävvejööch"?
Output:"Käävvejööch" ist ein Wort, das im Kölsch Dialekt verwendet wird und das Karneval bedeutet. Der Karneval ist ein Fest, das in Köln und anderen Städten im Rheinland jedes Jahr im Februar stattfindet. Es ist eine Zeit der Feiern, des Tanzens und der Kostüme, und es werden viele Straßenumzüge und Paraden veranstaltet. Der Karneval in Köln ist besonders bekannt und beliebt und zieht viele Besucher aus der ganzen