Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View b0o's full-sized avatar
👻

Maddison Hellstrom b0o

👻
View GitHub Profile
// Ported from https://github.com/trpc/trpc/blob/main/packages/server/src/adapters/ws.ts
import type { ServeOptions, Server, ServerWebSocket } from 'bun'
import {
AnyRouter,
CombinedDataTransformer,
ProcedureType,
TRPCError,
callProcedure,
/**
* Creates an async generator from a subscription procedure
*
* @param procedure - The procedure to subscribe to
* @param opts - Options for the subscription
* @param opts.isDone - A function that determines if the subscription is done,
* called for each value the subscription emits.
*
* @returns An async generator
*

/**

  • Creates an async generator from a subscription procedure
  • @param procedure The procedure to subscribe to
  • @param opts Options for the subscription
  • @returns An async generator
  • @example
  • const myProcedureGen = getSubscriptionGenerator(mySubscriptionProcedure, {
[Desktop Entry]
Version=1.0
Name=Kitty (Neovim)
GenericName=Text Editor
Comment=Neovim in Kitty
Keywords=kitty;nvim;neovim
Icon=kitty
Terminal=false
X-MultipleArgs=false
Type=Application
@b0o
b0o / fs.py
Created February 14, 2023 07:37
python multi-filesystem adapter with support for s3fs
"""
File system abstraction with support for additional kinds of file systems, including:
- regular file system
- s3 via s3fs
"""
from datetime import datetime
import io
import os
from functools import wraps
@b0o
b0o / maximize.lua
Last active October 27, 2022 21:46
-- maximize.lua: maximize the current buffer in a fullscreen floating window
-- Author: Maddison Hellstrom - github.com/b0o
-- Place in your lua directory (preferably use a subdirectory as a namespace)
-- Usage: vim.keymap.set('n', '<leader>z', require'maximize'.toggle)
local M = {}
local state = { winid = nil }
local is_open = function()
@b0o
b0o / README.md
Last active September 29, 2022 02:37
Wikipedia/MediaWiki Sidebar Table of Contents User Style

@b0o
b0o / aag
Last active April 16, 2022 00:54
aag: per-file logical AND of multiple ag searches
#!/bin/bash
#
# ag with logical AND of multiple searches
#
# Copyright (C) 2020 Maddison Hellstrom <https://github.com/b0o>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#!/usr/bin/env bash
# Use (neo)vim as your MANPAGER
# Set MANPAGER=/path/to/viman in your shellrc
#
# Copyright 2020-2022 Maddison Hellstrom <https://github.com/b0o>
# MIT License
set -Eeuo pipefail
shopt -s inherit_errexit