Skip to content

Instantly share code, notes, and snippets.

View r17x's full-sized avatar
🤘
REconciling...

RiN r17x

🤘
REconciling...
View GitHub Profile
{
description = "dungeoncrawler";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/master";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }:
@Hirrolot
Hirrolot / a-preface.md
Last active April 18, 2024 16:50
A complete implementation of the positive supercompiler from "A Roadmap to Metacomputation by Supercompilation" by Gluck & Sorensen

Supercompilation is a deep program transformation technique due to V. F. Turchin, a prominent computer scientist, cybernetician, physicist, and Soviet dissident. He described the concept as follows [^supercompiler-concept]:

A supercompiler is a program transformer of a certain type. The usual way of thinking about program transformation is in terms of some set of rules which preserve the functional meaning of the program, and a step-by-step application of these rules to the initial program. ... The concept of a supercompiler is a product of cybernetic thinking. A program is seen as a machine. To make sense of it, one must observe its operation. So a supercompiler does not transform the program by steps; it controls and observes (SUPERvises) the running of the machine that is represented by the program; let us call this machine M1. In observing the operation of

@VictorTaelin
VictorTaelin / itt-coc.ts
Last active March 2, 2024 15:53
ITT-Flavored Calculus of Constructions Type Checker
// A nano dependent type-checker featuring inductive types via self encodings.
// All computation rules are justified by interaction combinator semantics,
// resulting in major simplifications and improvements over old Kind-Core.
// Specifically, computable annotations (ANNs) and their counterpart (ANN
// binders) and a new self encoding based on equality (rather than dependent
// motives) greatly reduce code size. A more complete file, including
// superpositions (for optimal unification) is available on the
// Interaction-Type-Theory repository.
// Credits also to Franchu and T6 for insights.
@leandro
leandro / curry.js
Last active December 20, 2021 15:04
A curry function on JS
const curry = (fn, arity = null) => {
const realArity = fn.length;
const providedArity = arity === null ? realArity :
(arity > realArity ? realArity : arity);
return (...args) => {
const argsUsed = args.length > providedArity ? providedArity : args.length;
const finalFn = fn.bind(this, ...args.slice(0, argsUsed));
return realArity === argsUsed ? finalFn() : curry(finalFn);
type NatModule<Nat> = {
zero: Nat;
one: Nat;
add: (x: Nat, y: Nat) => Nat;
};
const NatModule = <A>(cb: <Nat>(Nat: NatModule<Nat>) => A) => {
const zero = 0;
const one = 1;
@sindresorhus
sindresorhus / esm-package.md
Last active May 3, 2024 10:19
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@573
573 / readme.md
Last active January 29, 2024 21:25
run services in docker in nixos in wsl(2)

Set up (pointers here) nixos first.

running the container like this docker run --name redis -dit -p 0.0.0.0:6379:6379 imagename (microsoft/WSL#5618 (comment)) let's you from the host windows do either:

Create [#file-redis-small.nix] like this (mod of https://yann.hodique.info/blog/using-nix-to-build-docker-images/, source: https://gist.github.com/sigma/9887c299da60955734f0fff6e2faeee0, this again modding http://lethalman.blogspot.com/2016/04/cheap-docker-images-with-nix_15.html, latter via https://nixos.wiki/wiki/Docker)

curl localhost:6379

or

@foosel
foosel / README.md
Last active January 11, 2024 20:23
OBS script that updates the YouTube livechat URL on a browser source on stream start.

youtube-live-chat-update.py

OBS script that updates the YouTube livechat URL on a browser source on stream start to the livechat associated with the (first) current livestream on a given channel. If no livestream is active, a placeholder page saying "No Stream." will be injected. You can style the text via the css class .nostream to match your background etc.

You will need a YouTube API key, see https://developers.google.com/youtube/v3/getting-started and https://developers.google.com/youtube/registering_an_application for more information on how to go about that.

Additionally you will require the channel ID of the channel for which you want to query the current live stream. You can retrieve that by inspecting the web site source of the channel in question and looking for externalId.

To use, download youtube-live-chat-update.py and add it as script to OBS Studio. Note: Be sure to configure a valid Python environment first, see here for more details.

@thalamus
thalamus / ArchLinuxARM-M1
Last active March 11, 2024 16:55
How to boot Arch Linux ARM in QEMU (patched for M1)
/*
* This document is provided to the public domain under the
* terms of the Creative Commons CC0 public domain license
*/
How to boot Arch Linux ARM in QEMU (patched for M1)
Prerequisites:
QEMU - patched for M1 processors - patches: https://github.com/utmapp/qemu