Skip to content

Instantly share code, notes, and snippets.

View b0o's full-sized avatar
👻

Maddison Hellstrom b0o

👻
View GitHub Profile
@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()
#!/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
#!/usr/bin/env bash
set -Eeuo pipefail
shopt -s inherit_errexit
declare vim="nvim"
command -v nvim &>/dev/null || vim="vim"
if [[ ! -t /dev/stdin ]]; then
MANPAGER='less' man "$@" -l -
elif [[ $# -gt 0 ]]; then
@b0o
b0o / Commands.ml
Last active January 16, 2022 23:05
let stringOfChannel ch =
let ok = ref false in
let result = ref "" in
let _ =
try
while true do
result := !result ^ "\n" ^ input_line ch
done
with End_of_file -> (
match Unix.close_process_in ch with
local shebang_regex = vim.regex([[^#!]])
local blank_or_comment_line_regex = vim.regex([[^\s*\(#.*\)\?$]])
local shellcheck_disable_regex = vim.regex([[^\s*#\s*shellcheck\s\+disable=\(\(SC\)\?\d\+\)\(,\(SC\)\?\d\+\)*\s*$]])
local shellcheck_disable_pattern = "^%s*#%s*shellcheck%s+disable=([^%s]*)%s*$"
-- Searches a region of the buffer `bufnr` for a ShellCheck disable directive.
-- The search proceeds from `row_start` to `row_end`.
-- If `row_start` is greater than `row_end`, the region is effectively searched in reverse.
-- A table representing first directive that's found is returned, otherwise nil.
local find_disable_directive = function(bufnr, row_start, row_end)
@b0o
b0o / audioctl
Last active October 22, 2021 16:24
audioctl
#!/usr/bin/env bash
# Copyright (c) 2018-2021 Maddison Hellstrom (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.
#
# This program is distributed in the hope that it will be useful,
[Default Applications]
text/plain=kitty-nvim.desktop;
[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