Source for https://www.val.town/v/saolsen/example_rust_http_val For build instructions see https://gist.github.com/saolsen/d273bb1baba5e912e4dc2b187511affa For usage see https://www.val.town/v/saolsen/use_example_rust_http_val
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See bucket_array.h | |
// Define the same variables, include the .h file and then include this file in one .c file. | |
#ifndef BA_PREFIX | |
#error "BA_PREFIX must be defined" | |
#endif | |
#ifndef BA_TYPEDEF_NAME | |
#error "BA_TYPEDEF_NAME must be defined" | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <assert.h> | |
#include <stdbool.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#define u8 uint8_t | |
#define i32 int32_t | |
#define u64 uint64_t | |
// Solutions are 8x8 matrices in row-major order. If the value is 1, there's a wall, if it's 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Single header file library for C. | |
// * Provides an arena allocator and some data structures that use it. | |
// | |
// * Maintains a (thread local) pool of arenas so they are cheap to acquire and release for temporary allocations. | |
// Since all allocations are backed by arenas you don't have to free anything individually, just | |
// use an arena that matches the lifetime of the data. | |
// * Includes data structures like a dynamic array that work well with the arena. | |
// * Allows for some optimizations like extending instead of reallocing if the array is on the end of an arena. | |
// * All lengths are signed. | |
// * Makes for less casting when comparing lengths and pointers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// wow, this is awesome | |
// you really don't need drizzle, this is much better | |
// I really kinda hate that copilot isn't working though... | |
import postgres from "npm:postgres"; | |
import PgBoss from "npm:pg-boss"; | |
interface World { | |
world: string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ARG DENO_VERSION=1.42.2 | |
ARG BIN_IMAGE=denoland/deno:bin-${DENO_VERSION} | |
FROM ${BIN_IMAGE} AS bin | |
FROM frolvlad/alpine-glibc:alpine-3.13 | |
RUN apk --no-cache add ca-certificates | |
RUN addgroup --gid 1000 deno \ | |
&& adduser --uid 1000 --disabled-password deno --ingroup deno \ |
Make a Val with rust.
Build a https://www.val.town/ val with rust. This is an example of how to compile a rust file to wasm and use it as a val.
Requires rust, wasm-pack and deno.
- Put your code in
val.rs
. - Build it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import batched | |
def ordered(a, b) -> bool | None: | |
match a, b: | |
case int(i), int(j): | |
if i == j: | |
return None | |
return i < j | |
case list(i), list(j): |
C-b :
capture-pane -S -
C-b :
save-buffer filename.txt
https://unix.stackexchange.com/questions/26548/write-all-tmux-scrollback-to-a-file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
target |
NewerOlder