Skip to content

Instantly share code, notes, and snippets.

View queercat's full-sized avatar
💖
Happy

May Tusek queercat

💖
Happy
View GitHub Profile
while true; do cat /dev/urandom | head -c 32 | base64 | { data=$(cat); length=$(echo -n "$data" | wc -m | awk '{print $1}'); echo -e "HTTP/1.1 200 OK\r\nContent-Length: $length\r\nContent-Type: text\r\n\r\n$data\r\n"; } | nc -l 1234; done
# Copyright (c) 2025 May Tusek
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
const std = @import("std");
const input =
\\ 41226 69190
\\ 89318 10100
\\ 59419 23880
\\ 63157 20193
\\ 81510 22869
\\ 83942 63304
\\ 83203 94187
@queercat
queercat / aoc-8.py
Last active December 8, 2024 07:10
challenge = """
......#....#
...#....0...
....#0....#.
..#....0....
....0....#..
.#....A.....
...#........
#......#....
........A...
@queercat
queercat / http.ts
Created October 30, 2024 19:09
Minimal HTTP framework in Deno.
interface route {
path: string
body: (path: string, values: Record<string, string>) => Promise<string | object | number> | string | object | number
}
const routes: route[] = [
{
path: "/resource/:value:",
body: (_, values) => {
return values.value
def bf(program):
cursor = 0
ip = 0
data = [0 for _ in range(10000000)]
while ip < len(program):
if program[ip] == '>':
cursor += 1
elif program[ip] == '<':
cursor -= 1
fn atof (str)
""""
1. cut off the sign if there is one provided. not possible except by recursion.
a. hold on to this value as a multiplicand in the end.
2. split the string into two two values (number) (exponent)
3. return the value gotten by multiplying the (sign) (number) (exponent)
returning f64
local number = str
local number-sign = 1:f64
using import struct
using import Array
using import enum
using import String
using import Map
# TODO;
# * On demand lexing.
# * Implement ATOF.
# * Implement solidus string parsing.
using import struct
using import enum
using import Array
using import Map
using import String
enum N : i32
N_STRING
N_NUMBER
N_OBJECT
using import struct
using import Array
struct Token
value : string = ""
kind : i8
position : i32
struct InputStream
source : string = ""