Skip to content

Instantly share code, notes, and snippets.

const dbg = (v, ...args) => (console.log(v, ...args), v)
const samplePick = (arr) => arr[~~(Math.random() * arr.length)]
const sortZeros = (arr, dir) =>
arr.sort((a, b) => (dir === 'end' ? a === 0 : b === 0) ? -1 : 1)
// Possibly the worst part of this code
// I would like to clean this up and optimize it at some point
const merge2048 = (arr, dir) => {
meta:
id: plymodel
endian: le
file-extension: plymodel
imports:
- /image/png
# strings are prefixed with thier length beforehand, and *do not* need to be aligned.
seq:
// Utils
export interface TypedResponse<T extends Record<string, unknown> | unknown = Record<string, unknown>> extends Response {
json<P = T extends Record<string, unknown> ? T['application/json'] : unknown>(): Promise<P>
}
export const encodeURLQueryString = (params: Record<string, string | number | boolean>) =>
Object.keys(params)
.map((k) => encodeURIComponent(k) + '=' + encodeURIComponent(params[k]))
.join("&");
{ pkgs }:
let
inherit(pkgs) lib fetchurl;
inherit(pkgs.perlPackages) buildPerlPackage;
packages = rec {
AlgorithmCombinatorics = buildPerlPackage {
pname = "Algorithm-Combinatorics";
version = "0.27";
src = fetchurl {
type SampleRoutes =
| {
method: "GET";
path: `/path/${string}/members`;
data: string;
body: null
}
| {
method: "GET";
path: `/path/${string}/date`;
// deno-lint-ignore-file camelcase
import { writableStreamFromWriter } from "https://deno.land/[email protected]/streams/mod.ts";
const text = await Deno.readTextFile("./mods.txt");
const [query, ...urls] = text.split(/\n/).map((l) => l.trim()).filter((l) =>
l.length > 0 && !l.startsWith("#")
);
const [loader, version] = query.split(" ");
const HOST = "https://api.modrinth.com";
import tkinter as tk
from threading import Thread
import random
import time
# ablak létrehozása
window = tk.Tk()
window.geometry("450x450+500+250")
window.configure(bg="#fff")
frame = tk.Frame(window, bg="#000000")
(module
;; Import the required fd_write WASI function which will write the given io vectors to stdout
;; The function signature for fd_write is:
;; (File Descriptor, *iovs, iovs_len, nwritten) -> Returns number of bytes written
(import "wasi_unstable" "fd_write" (func $fd_write (param i32 i32 i32 i32) (result i32)))
(import "wasi_unstable" "fd_read" (func $fd_read (param i32 i32 i32 i32) (result i32)))
(memory 1)
(export "memory" (memory 0))
type Tuple<V, N extends number, T extends V[] = []> =
N extends T['length'] ? T : Tuple<V, N, [...T, V]>;
type Nat = Nat[]
type ToNumber<N extends Nat> = N['length']
type FromNumber<N extends number> = Tuple<Nat, N>
type Zero = []
type One = [Nat]
type N2 = Add<One, One>
@brecert
brecert / css.css
Last active February 9, 2022 07:53
.profile { color: rebeccapurple }