Skip to content

Instantly share code, notes, and snippets.

View SimonMeskens's full-sized avatar

Simon Meskens SimonMeskens

View GitHub Profile

Pick either the second or third paragraph and the final one is optional.

Copyright (c) 2024 «AUTHORS»

In the name of a free and open culture, you may do anything with this software that copyright law would normally restrict, provided this license is preserved. This software is offered as-is, without any warranty.

To the extent permitted under applicable law, worldwide, all copyright holders fully waive their copyrights to this software and dedicate it to the public domain.

This software or any derivatives of this software can only be distributed with their source code publicly available; software that is distributed with this software as part of it should also require the same. Services can only make use of this software provided that any modifications are publicly available.

@SimonMeskens
SimonMeskens / UTF-8
Last active February 13, 2024 05:22
UTF-8 Code point: a bb bb cc cc dd dd ee ee ff ff
0 e ee ff ff
10 ------- ----------- ---- ERROR -----------
110 d dd ee 10 ee ff ff
1110 cc cc 10 dd dd ee 10 ee ff ff
11110 a bb 10 bb cc cc 10 dd dd ee 10 ee ff ff
111110 ------- ----------- ---- ERROR -----------
@SimonMeskens
SimonMeskens / parser.js
Last active April 29, 2022 00:43
Tiny Parser Combinator Library
/*
Copyright 2022 Simon Meskens
Permission to use, copy, modify, and/or distribute this software for any purpose with
or without fee is hereby granted, provided this license is preserved. This software is
offered as-is, without any warranty.
Generate your own tiny license:
https://simonmeskens.github.io/SimpleLicenseCollection/
*/
@SimonMeskens
SimonMeskens / Voucher.js
Created April 6, 2022 14:47
A lazy promise that only tries to resolve itself when prompted.
/**
* @module
* @copyright Simon Meskens 2022
* @license
* Copying and distribution of this file, with or without modification,
* are permitted in any medium without royalty, provided the copyright
* notice and this notice are preserved. This file is offered as-is,
* without any warranty.
*/

Design challenge: design or share a regular expression DSL

Design a syntax for an alternative to classic regex. You can also share interesting existing solutions. An example of a regular expression to try implementing is the JSON number spec:

n = /-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/

All the examples here are licensed CC0. If you would like to share a solution for addition to this gist (and later a repository), send it to me and mention that you license it under CC0. If you would like to be attributed, mention under what name.

Existing solutions

@SimonMeskens
SimonMeskens / Simulation Theory.md
Created November 26, 2021 00:45
Do we live in a simulation?

Here's a good question: if we are living in a simulation, what are our expectations? If we study whether or not that's true, what is the most logical evidence we'd expect to find? I would posit that we'd have to somehow discover inconsistencies that don't seem to make sense, unless viewed from the lens of being in a simulation. For example, maybe we start looking really closely at the world, to the smallest particles and suddenly the laws of physics seem to flip around and stop making sense. If we saw that, we'd almost have to conclude the most logical explanation is that we're looking at the rules of the substrate our simulation is running on. Due to memory access and stuff like that, those substrate rules would probably break all sorts of locality laws and stuff.

Imagine if that was the case, how weird would that be?

@SimonMeskens
SimonMeskens / Lambda.ts
Created November 23, 2021 21:24
Lambda calculus in the TS type system
type Test1 = λ<Not, [True]>; // False
type Test2 = λ<And, [True, False]>; // False
type Test3 = λ<And, [True, True]>; // True
// Boolean
interface True extends Func { expression: Var<this, 0>; }
interface False extends Func { expression: Var<this, 1>; }
interface Not extends Func { expression: λ<Var<this, 0>, [False, True]> }
interface And extends Func { expression: λ<Var<this, 0>, [Var<this, 1>, Var<this, 0>]> }
@SimonMeskens
SimonMeskens / LISP.js
Created November 13, 2021 22:50
Tiny LISP parser and interpreter
// Parser
const string = /"(?:\\(?:["\\\/bfnrt]|u[a-fA-F0-9]{4})|[^"\\\0-\x1F\x7F]+)*"/;
const number = /-?(?:0|[1-9][0-9]*)(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?/;
const identifier = /[^()\s,:"']+/;
const combine = (...args) => new RegExp(args.map(arg => `(?:${arg.source})`).join("|"), "g");
const tokenize = input => input.matchAll(combine(/[()]/, identifier, string, number));
const construct = iterator => {

De Novo

Goals

  • Make early game BTW more survivable, without killing all challenge, by introducing more mechanics like fishing that are tedious
  • Allow survival on a map with nothing but a bedrock plane (truly from nothing or De Novo)
  • Allow progression on a survival island with no trees or animals to crafting a boat
  • Allow progression in the nether from nothing to nether portal
  • Designed to give full access to the entire tech tree combined with BWR (for example, BWR doesn't offer an end portal method)
  • Support skyblock, survival island seeds, single biome maps for any biome type and flatmaps without structures