Skip to content

Instantly share code, notes, and snippets.

View Kreijstal's full-sized avatar
↗️

Kreijstal Kreijstal

↗️
View GitHub Profile
@Kreijstal
Kreijstal / PonyTown.js
Last active April 24, 2024 06:37
Hacks for not popular glorified chat called ponytown
//>implying whoever reads it can understand this
//Minified code from Rainb Essentials.
var genParser=function(e,t,n){function r(e,t){var n,r,i,a;return e?e instanceof RegExp?(i=new RegExp,i.compile("^(?:"+e.source+")",(e.multiline?"m":"")+(e.eturnignoreCase?"i":"")),n=i.exec(o.substr(s)),r=n&&n[0],null===r?null:(s+=r.length,r)):"string"==typeof e?e===o.substr(s,e.length)?(s+=e.length,e):null:(r=e.type,a=c[r],n=a(e,t),a?n:null):null}function i(e){return o=e,s=0,a.unknown(r(u))}var o,s,a=t,u={type:"type",is:n},c={expression:function(e){var t,n,i,o,s,a,u,c,l,p,f,h,d,g={type:"alternate",contains:[e.contains]},b={type:"alternate",contains:[]},y={type:"alternate",contains:[]},m=[],v=[];if(c=e.operators){for(t=0,i=c.length;i>t;t++)for(n=0,o=c[t].tokens.length;o>n;n++)a=c[t].tokens[n],e.whiteSpaceIgnore?"string"==typeof a?b.contains.push(new RegExp("\\s*(?:"+a.replace(/([-+\\?.!$^&*(){}[\]])/g,"\\$1")+")\\s*")):a instanceof RegExp?b.contains.push(new RegExp("\\s*(?:"+a.source+")\\s*",(a.multiline?"m":"")+(a.ignoreCa
@Kreijstal
Kreijstal / binaryparsercombinator.js
Last active April 14, 2024 13:24
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 / bootstrap.ps1
Last active February 12, 2024 23:47
install msys2, nvim and comfortable configuration
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 0
Set-ExecutionPolicy Bypass -scope Process -Force
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
irm get.scoop.sh | iex
#http://helloworldproject.blogspot.com/2021/01/setting-up-rust-on-windows-10-with.html
scoop install msys2
ucrt64 -c "yes|pacman -Syuu"
ucrt64 -c "yes|pacman -Syuu"
ucrt64 -c "pacman -S pactoys openssh curl --noconfirm git vim"
ucrt64 -c (@"
@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