Skip to content

Instantly share code, notes, and snippets.

View b0o's full-sized avatar
👻
Boo!

Maddison Hellstrom b0o

👻
Boo!
View GitHub Profile
@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 / 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

/**

  • 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, {
/**
* 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
*
// 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,
@b0o
b0o / README.md
Last active December 3, 2023 00:56
LSP support in injected code blocks with Otter.nvim

LSP support in injected code blocks with Otter.nvim

Otter.nvim makes it possible to attach LSPs to embedded code blocks. For example, inside JavaScript/TypeScript files, you can use tagged template literals:

const frag = glsl`
void main() {
  gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}
`;
-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
Dec 07 17:03:46 computer1 systemd[3951]: Started GnuPG cryptographic agent and passphrase cache.
Dec 07 17:03:46 computer1 gpg-agent[1740396]: gpg-agent (GnuPG) 2.4.3 starting in supervised mode.
Dec 07 17:03:46 computer1 gpg-agent[1740396]: using fd 3 for extra socket (/run/user/1000/gnupg/S.gpg-agent.extra)
Dec 07 17:03:46 computer1 gpg-agent[1740396]: using fd 4 for browser socket (/run/user/1000/gnupg/S.gpg-agent.browser)
Dec 07 17:03:46 computer1 gpg-agent[1740396]: using fd 5 for std socket (/run/user/1000/gnupg/S.gpg-agent)
Dec 07 17:03:46 computer1 gpg-agent[1740396]: using fd 6 for ssh socket (/run/user/1000/gnupg/S.gpg-agent.ssh)
Dec 07 17:03:46 computer1 gpg-agent[1740396]: listening on: std=5 extra=3 browser=4 ssh=6
Dec 07 17:03:46 computer1 sway[4049]: 21:51:40.094 [DEBUG] [wlr] [types/wlr_text_input_v3.c:185] Text input commit received without focus
Dec 07 17:03:46 computer1 sway[4049]: 21:51:40.094 [DEBUG] [sway/input/text_input.c:159] Text input committed update
Dec 07 17:03:46 computer1 sway[
#!/usr/bin/env bash
if [[ ${1:-} == "--inner" ]]; then
echo "Inner"
exit 0
fi
echo "Outer"
echo "${BASH_SOURCE[0]}" | entr "${BASH_SOURCE[0]}" --inner