Skip to content

Instantly share code, notes, and snippets.

View jprochazk's full-sized avatar
💭
📦

Jan Procházka jprochazk

💭
📦
View GitHub Profile
use std::marker::PhantomData;
use std::ops::{Deref, DerefMut, Index, IndexMut};
pub struct EnumArray<const LEN: usize, E: Into<usize>, V: Copy> {
array: [V; LEN],
index: PhantomData<fn() -> E>,
}
impl<const LEN: usize, E: Into<usize>, V: Copy> EnumArray<LEN, E, V> {
pub fn new(v: V) -> Self {
@jprochazk
jprochazk / data.json
Created February 7, 2024 19:14
parse-rosetta-rs benchmark data
{
"timestamp": "2024-02-07",
"hostname": "DESKTOP-HLQEUO4",
"os": "Linux",
"os_ver": "5.15.133.1-microsoft-standard-WSL2",
"arch": "x86_64",
"cpus": 32,
"libs": {
"examples/chumsky-app/Cargo.toml": {
"name": "chumsky",
@jprochazk
jprochazk / Dockerfile
Created January 9, 2024 09:29
minimal rust dockerfile
# syntax = docker/dockerfile:experimental
# Replace `THE_PROGRAM` with the name of your binary
FROM rust:1.75 as builder
RUN useradd -m rust
ENV HOME /home/rust
@jprochazk
jprochazk / dag.py
Last active October 9, 2023 12:02
python parallel DAG
from __future__ import annotations
import time
from concurrent.futures import ThreadPoolExecutor
from multiprocessing import Event, cpu_count
from multiprocessing.synchronize import Event as EventClass
from queue import Empty, Queue
from typing import Callable, Generic, Hashable, TypeVar
T = TypeVar("T", bound=Hashable)
<script>
import { count } from "./state";
</script>
<h2>{$count}</h2>
<button on:click={() => $count += 1}>Inc</button>
import { writable } from "svelte/store";
export const count = writable(0);
<script>
import { count } from "./state";
</script>
<h2>{$count}</h2>
<button on:click={() => $count += 1}>Inc</button>
@jprochazk
jprochazk / gc_resources.md
Created February 27, 2023 07:08 — forked from mrnugget/gc_resources.md
Resources I used so far (26 feb 2023) to build a GC for my toy compiler
[gchb]: https://gchandbook.org/
[clawing]: https://blog.mozilla.org/javascript/2013/07/18/clawing-our-way-back-to-precision/
[gsgc]: https://piumarta.com/software/gsgc/index.shtml
[migc]: https://github.com/playXE/migc
[yarpenruntime]: https://github.com/mdlugajczyk/yarpen/blob/master/runtime/yarpen_runtime.c
[bdwgc]: https://www.hboehm.info/gc/
[bdwgcslides]: https://www.hboehm.info/gc/04tutorial.pdf
[bdwdescr]: https://hboehm.info/gc/gcdescr.html
[writinginterpretersinrust]: https://rust-hosted-langs.github.io/book/introduction.html
[gcandrustpart0]: http://blog.pnkfx.org/blog/2015/10/27/gc-and-rust-part-0-how-does-gc-work/